summaryrefslogtreecommitdiff
path: root/include/llvm
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2014-03-10 15:03:06 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2014-03-10 15:03:06 +0000
commit6e9eeab69f0ce496d0120f9718e026f319d2ab01 (patch)
treef389bfb8de421b8380413c1f04454c2dbbea203c /include/llvm
parente1820a6a4e5cfd1a41bd40ce6c21635d04289fec (diff)
downloadllvm-6e9eeab69f0ce496d0120f9718e026f319d2ab01.tar.gz
llvm-6e9eeab69f0ce496d0120f9718e026f319d2ab01.tar.bz2
llvm-6e9eeab69f0ce496d0120f9718e026f319d2ab01.tar.xz
[C++11] Modernize the IR library a bit.
No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203465 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/IR/DataLayout.h8
-rw-r--r--include/llvm/IR/MDBuilder.h7
-rw-r--r--include/llvm/IR/User.h4
3 files changed, 8 insertions, 11 deletions
diff --git a/include/llvm/IR/DataLayout.h b/include/llvm/IR/DataLayout.h
index d32b8402d6..8ad9bd0f4a 100644
--- a/include/llvm/IR/DataLayout.h
+++ b/include/llvm/IR/DataLayout.h
@@ -219,8 +219,8 @@ public:
/// The width is specified in bits.
///
bool isLegalInteger(unsigned Width) const {
- for (unsigned i = 0, e = (unsigned)LegalIntWidths.size(); i != e; ++i)
- if (LegalIntWidths[i] == Width)
+ for (unsigned LegalIntWidth : LegalIntWidths)
+ if (LegalIntWidth == Width)
return true;
return false;
}
@@ -283,8 +283,8 @@ public:
/// only supports i32 as a native integer type, then i27 fits in a legal
// integer type but i45 does not.
bool fitsInLegalInteger(unsigned Width) const {
- for (unsigned i = 0, e = (unsigned)LegalIntWidths.size(); i != e; ++i)
- if (Width <= LegalIntWidths[i])
+ for (unsigned LegalIntWidth : LegalIntWidths)
+ if (Width <= LegalIntWidth)
return true;
return false;
}
diff --git a/include/llvm/IR/MDBuilder.h b/include/llvm/IR/MDBuilder.h
index ce81b5498f..c07b2bdc17 100644
--- a/include/llvm/IR/MDBuilder.h
+++ b/include/llvm/IR/MDBuilder.h
@@ -174,11 +174,8 @@ public:
/// given name, an offset and a parent in the TBAA type DAG.
MDNode *createTBAAScalarTypeNode(StringRef Name, MDNode *Parent,
uint64_t Offset = 0) {
- SmallVector<Value *, 4> Ops(3);
- Type *Int64 = IntegerType::get(Context, 64);
- Ops[0] = createString(Name);
- Ops[1] = Parent;
- Ops[2] = ConstantInt::get(Int64, Offset);
+ ConstantInt *Off = ConstantInt::get(Type::getInt64Ty(Context), Offset);
+ Value *Ops[3] = { createString(Name), Parent, Off };
return MDNode::get(Context, Ops);
}
diff --git a/include/llvm/IR/User.h b/include/llvm/IR/User.h
index d288e1908c..061bc91d31 100644
--- a/include/llvm/IR/User.h
+++ b/include/llvm/IR/User.h
@@ -178,8 +178,8 @@ public:
// delete.
//
void dropAllReferences() {
- for (op_iterator i = op_begin(), e = op_end(); i != e; ++i)
- i->set(0);
+ for (Use &U : operands())
+ U.set(0);
}
/// replaceUsesOfWith - Replaces all references to the "From" definition with