[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
This commit is contained in:
Chandler Carruth
2014-03-09 03:16:50 +00:00
parent cdf4788401
commit 4d01fff492
6 changed files with 10 additions and 14 deletions

View File

@@ -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

View File

@@ -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);

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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

View File

@@ -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.