[llvm-commits] [lld] r172512 - in /lld/trunk: include/lld/Core/range.h unittests/CMakeLists.txt unittests/RangeTest.cpp

Chris Lattner clattner at apple.com
Thu Mar 21 21:18:56 PDT 2013


On Mar 21, 2013, at 2:53 PM, John McCall <rjmccall at apple.com> wrote:

> On Jan 14, 2013, at 10:55 PM, Michael J. Spencer <bigcheesegs at gmail.com> wrote:
>> Author: mspencer
>> Date: Tue Jan 15 00:55:25 2013
>> New Revision: 172512
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=172512&view=rev
>> Log:
>> [Core] Add iterator ranges.
>> 
>> This is based on code by Jeffrey Yasskin. It has been modified to compile
>> with MSVC and reformated to LLVM style.
> 
> Very late comment, I know, but this seems like a reasonable addition to
> LLVM's ADT library, especially if it can be adapted to at least allow instantiation
> under C++03.  We've been talking for some time about allowing non-core LLVM
> subsystems (like the static analyzer) use C++11, and of course there are tons of
> external projects that are free to use C++11 as they like.  LLVM and Clang have
> a *lot* of types with "tagged" iterators, like llvm::Value::use_iterator and
> clang::DeclContext::decl_iterator;  with this class in-tree, it would become very
> straightforward to start adding range adapters to a lot of those interfaces.
> That would be a pretty nice enhancement to get in for the 3.3 release.

Interesting idea.  I think it would be great if core LLVM classes had (properly ifdef'd) methods like "llvm::Value::uses()" or "llvm::Module::functions()" which could be used in a C++'11 foreach loop.

-Chris



More information about the llvm-commits mailing list