llvm-6502/tools
Chandler Carruth 36b699f2b1 [C++11] Add range based accessors for the Use-Def chain of a Value.
This requires a number of steps.
1) Move value_use_iterator into the Value class as an implementation
   detail
2) Change it to actually be a *Use* iterator rather than a *User*
   iterator.
3) Add an adaptor which is a User iterator that always looks through the
   Use to the User.
4) Wrap these in Value::use_iterator and Value::user_iterator typedefs.
5) Add the range adaptors as Value::uses() and Value::users().
6) Update *all* of the callers to correctly distinguish between whether
   they wanted a use_iterator (and to explicitly dig out the User when
   needed), or a user_iterator which makes the Use itself totally
   opaque.

Because #6 requires churning essentially everything that walked the
Use-Def chains, I went ahead and added all of the range adaptors and
switched them to range-based loops where appropriate. Also because the
renaming requires at least churning every line of code, it didn't make
any sense to split these up into multiple commits -- all of which would
touch all of the same lies of code.

The result is still not quite optimal. The Value::use_iterator is a nice
regular iterator, but Value::user_iterator is an iterator over User*s
rather than over the User objects themselves. As a consequence, it fits
a bit awkwardly into the range-based world and it has the weird
extra-dereferencing 'operator->' that so many of our iterators have.
I think this could be fixed by providing something which transforms
a range of T&s into a range of T*s, but that *can* be separated into
another patch, and it isn't yet 100% clear whether this is the right
move.

However, this change gets us most of the benefit and cleans up
a substantial amount of code around Use and User. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203364 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-09 03:16:01 +00:00
..
bugpoint [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-08 08:27:28 +00:00
bugpoint-passes [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-08 08:27:28 +00:00
gold Replace OwningPtr<T> with std::unique_ptr<T>. 2014-03-06 05:51:42 +00:00
llc Replace OwningPtr<T> with std::unique_ptr<T>. 2014-03-06 05:51:42 +00:00
lli [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-08 08:27:28 +00:00
llvm-ar Replace OwningPtr<T> with std::unique_ptr<T>. 2014-03-06 05:51:42 +00:00
llvm-as Replace OwningPtr<T> with std::unique_ptr<T>. 2014-03-06 05:51:42 +00:00
llvm-bcanalyzer Replace OwningPtr<T> with std::unique_ptr<T>. 2014-03-06 05:51:42 +00:00
llvm-c-test Use -std=gnu99 in tools/llvm-c-test/CMakeLists.txt 2014-01-08 11:48:19 +00:00
llvm-config Don't emit a blank line when running llvm-config --system-libs. 2014-03-03 15:06:14 +00:00
llvm-cov Replace OwningPtr<T> with std::unique_ptr<T>. 2014-03-06 05:51:42 +00:00
llvm-diff [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-08 08:27:28 +00:00
llvm-dis [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-08 08:27:28 +00:00
llvm-dwarfdump Replace OwningPtr<T> with std::unique_ptr<T>. 2014-03-06 05:51:42 +00:00
llvm-extract Replace OwningPtr<T> with std::unique_ptr<T>. 2014-03-06 05:51:42 +00:00
llvm-jitlistener Support: split object format out of environment 2014-03-06 20:47:11 +00:00
llvm-link Replace OwningPtr<T> with std::unique_ptr<T>. 2014-03-06 05:51:42 +00:00
llvm-lto Replace OwningPtr<T> with std::unique_ptr<T>. 2014-03-06 05:51:42 +00:00
llvm-mc [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-08 08:27:28 +00:00
llvm-mcmarkup Replace OwningPtr<T> with std::unique_ptr<T>. 2014-03-06 05:51:42 +00:00
llvm-nm Replace OwningPtr<T> with std::unique_ptr<T>. 2014-03-06 05:51:42 +00:00
llvm-objdump Change MCDisassembler::setSymbolizer to take unique_ptr by value. 2014-03-07 09:38:02 +00:00
llvm-profdata Replace OwningPtr<T> with std::unique_ptr<T>. 2014-03-06 05:51:42 +00:00
llvm-readobj [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-08 08:27:28 +00:00
llvm-rtdyld [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-08 08:27:28 +00:00
llvm-shlib Add patch level to llvm version in CMake and Autoconf 2014-03-03 15:22:00 +00:00
llvm-size Replace OwningPtr<T> with std::unique_ptr<T>. 2014-03-06 05:51:42 +00:00
llvm-stress [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-08 08:27:28 +00:00
llvm-symbolizer Replace OwningPtr<T> with std::unique_ptr<T>. 2014-03-06 05:51:42 +00:00
lto Centralize the handling of install_name and rpath. 2014-02-28 13:48:03 +00:00
macho-dump Replace OwningPtr<T> with std::unique_ptr<T>. 2014-03-06 05:51:42 +00:00
msbuild MSBuild integration: get the LibraryPath right (PR18707) 2014-02-13 22:01:35 +00:00
obj2yaml Replace OwningPtr<T> with std::unique_ptr<T>. 2014-03-06 05:51:42 +00:00
opt [C++11] Add range based accessors for the Use-Def chain of a Value. 2014-03-09 03:16:01 +00:00
yaml2obj Replace OwningPtr<T> with std::unique_ptr<T>. 2014-03-06 05:51:42 +00:00
CMakeLists.txt Remove out-of-date comment in llvm/tools/CMakeLists.txt. 2014-03-04 16:13:21 +00:00
LLVMBuild.txt PGO: llvm-profdata: tool for merging profiles 2014-02-17 23:22:49 +00:00
Makefile PGO: llvm-profdata: tool for merging profiles 2014-02-17 23:22:49 +00:00