diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2014-03-09 03:16:50 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2014-03-09 03:16:50 +0000 |
commit | 4d01fff4923795055c19272d08247d66cc2ed1fd (patch) | |
tree | a35c029350f0ddb710086981cf1aa1c451baabc1 /clang | |
parent | cdf4788401afff02e12279fc1fded94d6180639c (diff) | |
download | bcm5719-llvm-4d01fff4923795055c19272d08247d66cc2ed1fd.tar.gz bcm5719-llvm-4d01fff4923795055c19272d08247d66cc2ed1fd.zip |
[C++11] Update Clang for the change to LLVM's Use-Def chain iterators in
r203364: what was use_iterator is now user_iterator, and there is
a use_iterator for directly iterating over the uses.
This also switches to use the range-based APIs where appropriate.
llvm-svn: 203365
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 2 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGCleanup.cpp | 2 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGException.cpp | 9 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGStmt.cpp | 5 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 2 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 4 |
6 files changed, 10 insertions, 14 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 4f564df208a..a39f13b5191 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -1742,7 +1742,7 @@ static llvm::StoreInst *findDominatingStoreToReturnValue(CodeGenFunction &CGF) { } llvm::StoreInst *store = - dyn_cast<llvm::StoreInst>(CGF.ReturnValue->use_back()); + dyn_cast<llvm::StoreInst>(CGF.ReturnValue->user_back()); if (!store) return 0; // These aren't actually possible for non-coerced returns, and we diff --git a/clang/lib/CodeGen/CGCleanup.cpp b/clang/lib/CodeGen/CGCleanup.cpp index 3cf21bb9c33..8748224b3e5 100644 --- a/clang/lib/CodeGen/CGCleanup.cpp +++ b/clang/lib/CodeGen/CGCleanup.cpp @@ -528,7 +528,7 @@ static void destroyOptimisticNormalEntry(CodeGenFunction &CGF, llvm::BasicBlock *unreachableBB = CGF.getUnreachableBlock(); for (llvm::BasicBlock::use_iterator i = entry->use_begin(), e = entry->use_end(); i != e; ) { - llvm::Use &use = i.getUse(); + llvm::Use &use = *i; ++i; use.set(unreachableBB); diff --git a/clang/lib/CodeGen/CGException.cpp b/clang/lib/CodeGen/CGException.cpp index 97d9fbb06f9..607566ca231 100644 --- a/clang/lib/CodeGen/CGException.cpp +++ b/clang/lib/CodeGen/CGException.cpp @@ -263,12 +263,9 @@ static llvm::Constant *getOpaquePersonalityFn(CodeGenModule &CGM, /// Check whether a personality function could reasonably be swapped /// for a C++ personality function. static bool PersonalityHasOnlyCXXUses(llvm::Constant *Fn) { - for (llvm::Constant::use_iterator - I = Fn->use_begin(), E = Fn->use_end(); I != E; ++I) { - llvm::User *User = *I; - + for (llvm::User *U : Fn->users()) { // Conditionally white-list bitcasts. - if (llvm::ConstantExpr *CE = dyn_cast<llvm::ConstantExpr>(User)) { + if (llvm::ConstantExpr *CE = dyn_cast<llvm::ConstantExpr>(U)) { if (CE->getOpcode() != llvm::Instruction::BitCast) return false; if (!PersonalityHasOnlyCXXUses(CE)) return false; @@ -276,7 +273,7 @@ static bool PersonalityHasOnlyCXXUses(llvm::Constant *Fn) { } // Otherwise, it has to be a landingpad instruction. - llvm::LandingPadInst *LPI = dyn_cast<llvm::LandingPadInst>(User); + llvm::LandingPadInst *LPI = dyn_cast<llvm::LandingPadInst>(U); if (!LPI) return false; for (unsigned I = 0, E = LPI->getNumClauses(); I != E; ++I) { diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index 80a8da76cc5..d69c5cdf9e4 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -311,9 +311,8 @@ void CodeGenFunction::EmitBranch(llvm::BasicBlock *Target) { void CodeGenFunction::EmitBlockAfterUses(llvm::BasicBlock *block) { bool inserted = false; - for (llvm::BasicBlock::use_iterator - i = block->use_begin(), e = block->use_end(); i != e; ++i) { - if (llvm::Instruction *insn = dyn_cast<llvm::Instruction>(*i)) { + for (llvm::User *u : block->users()) { + if (llvm::Instruction *insn = dyn_cast<llvm::Instruction>(u)) { CurFn->getBasicBlockList().insertAfter(insn->getParent(), block); inserted = true; break; diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index d35ab739e66..5028d5ddeca 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -158,7 +158,7 @@ void CodeGenFunction::EmitReturnBlock() { // cleans up functions which started with a unified return block. if (ReturnBlock.getBlock()->hasOneUse()) { llvm::BranchInst *BI = - dyn_cast<llvm::BranchInst>(*ReturnBlock.getBlock()->use_begin()); + dyn_cast<llvm::BranchInst>(*ReturnBlock.getBlock()->user_begin()); if (BI && BI->isUnconditional() && BI->getSuccessor(0) == ReturnBlock.getBlock()) { // Reset insertion point, including debug location, and delete the diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index a5cd9e34af5..c8dd8136fd2 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1938,7 +1938,7 @@ static void replaceUsesOfNonProtoConstant(llvm::Constant *old, for (llvm::Value::use_iterator ui = old->use_begin(), ue = old->use_end(); ui != ue; ) { llvm::Value::use_iterator use = ui++; // Increment before the use is erased. - llvm::User *user = *use; + llvm::User *user = use->getUser(); // Recognize and replace uses of bitcasts. Most calls to // unprototyped functions will use bitcasts. @@ -1951,7 +1951,7 @@ static void replaceUsesOfNonProtoConstant(llvm::Constant *old, // Recognize calls to the function. llvm::CallSite callSite(user); if (!callSite) continue; - if (!callSite.isCallee(use)) continue; + if (!callSite.isCallee(&*use)) continue; // If the return types don't match exactly, then we can't // transform this call unless it's dead. |