Readdress r236990, use of static members on a non-static variable.

The TargetRegistry is just a namespace-like class, instantiated in one
place to use a range-based for loop. Instead, expose access to the
registry via a range-based 'targets()' function instead. This makes most
uses a bit awkward/more verbose - but eventually we should just add a
range-based find_if function which will streamline these functions. I'm
happy to mkae them a bit awkward in the interim as encouragement to
improve the algorithms in time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237059 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie
2015-05-11 22:20:48 +00:00
parent aeda490976
commit bbd301d97a
5 changed files with 46 additions and 53 deletions

View File

@ -543,7 +543,14 @@ namespace llvm {
/// TargetRegistry - Generic interface to target specific features.
struct TargetRegistry {
class iterator {
// FIXME: Make this a namespace, probably just move all the Register*
// functions into Target (currently they all just set members on the Target
// anyway, and Target friends this class so those functions can...
// function).
TargetRegistry() = delete;
class iterator
: public std::iterator<std::forward_iterator_tag, Target, ptrdiff_t> {
const Target *Current;
explicit iterator(Target *T) : Current(T) {}
friend struct TargetRegistry;
@ -586,9 +593,7 @@ namespace llvm {
/// @name Registry Access
/// @{
static iterator begin();
static iterator end() { return iterator(); }
static iterator_range<iterator> targets();
/// lookupTarget - Lookup a target based on a target triple.
///