diff options
author | Pete Cooper <peter_cooper@apple.com> | 2015-07-30 17:22:52 +0000 |
---|---|---|
committer | Pete Cooper <peter_cooper@apple.com> | 2015-07-30 17:22:52 +0000 |
commit | 57d3f145025c4ad6f946d64a3a05f93ffb5fb405 (patch) | |
tree | 4d9fa1ec72bb46d38d7b8b8795d3ac07ed5d585b /clang/lib/Analysis/CFG.cpp | |
parent | 7a0c3a92c0c768eb6cf4cdad565ed9173cac0e75 (diff) | |
download | bcm5719-llvm-57d3f145025c4ad6f946d64a3a05f93ffb5fb405.tar.gz bcm5719-llvm-57d3f145025c4ad6f946d64a3a05f93ffb5fb405.zip |
Use llvm::reverse to make a bunch of loops use foreach. NFC.
In llvm commit r243581, a reverse range adapter was added which allows
us to change code such as
for (auto I = Fields.rbegin(), E = Fields.rend(); I != E; ++I) {
in to
for (const FieldDecl *I : llvm::reverse(Fields))
This commit changes a few of the places in clang which are eligible to use
this new adapter.
llvm-svn: 243663
Diffstat (limited to 'clang/lib/Analysis/CFG.cpp')
-rw-r--r-- | clang/lib/Analysis/CFG.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp index 07b80edfe69..3a358f91b09 100644 --- a/clang/lib/Analysis/CFG.cpp +++ b/clang/lib/Analysis/CFG.cpp @@ -994,9 +994,8 @@ std::unique_ptr<CFG> CFGBuilder::buildCFG(const Decl *D, Stmt *Statement) { // For C++ constructor add initializers to CFG. if (const CXXConstructorDecl *CD = dyn_cast_or_null<CXXConstructorDecl>(D)) { - for (CXXConstructorDecl::init_const_reverse_iterator I = CD->init_rbegin(), - E = CD->init_rend(); I != E; ++I) { - B = addInitializer(*I); + for (auto *I : llvm::reverse(CD->inits())) { + B = addInitializer(I); if (badCFG) return nullptr; } |