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

John McCall rjmccall at apple.com
Fri Mar 22 10:08:00 PDT 2013


On Mar 22, 2013, at 2:27 AM, Michael Spencer <bigcheesegs at gmail.com> wrote:
> On Thu, 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.
> 
> John.
> 
> I originally intended to port as much as possible to C++03 and stick it in LLVM ADT, but there were concerns with adopting this specific API as it may be significantly different from what gets standardized in C++1y.
> 
> I'm in favor of some support for the range concept in LLVM, even if it's just a begin/end pair.

Yeah, I think a range<T> that just pairs a begin and end iterator and lets you
iterate over it with the C++11 for-range syntax would provide roughly 99% of
the utility of the more general thing.

Do you want to handle this, or should I just sketch out a range with zero bells
and whistles and commit it?

John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130322/22b0dc4d/attachment.html>


More information about the llvm-commits mailing list