diff options
author | Jay Foad <jay.foad@gmail.com> | 2009-05-21 09:52:38 +0000 |
---|---|---|
committer | Jay Foad <jay.foad@gmail.com> | 2009-05-21 09:52:38 +0000 |
commit | 2d9b3cbe342bca2e2ec06f74e90a949c43b89fce (patch) | |
tree | e24fe092d1dd38aa6e28777260f3aef0f9eacf46 /lib/Analysis | |
parent | b2acf43c863f86bf1ac92f82b3de205c3e5ac84a (diff) | |
download | external_llvm-2d9b3cbe342bca2e2ec06f74e90a949c43b89fce.zip external_llvm-2d9b3cbe342bca2e2ec06f74e90a949c43b89fce.tar.gz external_llvm-2d9b3cbe342bca2e2ec06f74e90a949c43b89fce.tar.bz2 |
Use v.data() instead of &v[0] when SmallVector v might be empty.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72210 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/ConstantFolding.cpp | 10 | ||||
-rw-r--r-- | lib/Analysis/DebugInfo.cpp | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp index 00b5441..e5ab322 100644 --- a/lib/Analysis/ConstantFolding.cpp +++ b/lib/Analysis/ConstantFolding.cpp @@ -260,7 +260,7 @@ static Constant *FoldBitCast(Constant *C, const Type *DestTy, } } - return ConstantVector::get(&Result[0], Result.size()); + return ConstantVector::get(Result.data(), Result.size()); } } @@ -306,10 +306,10 @@ Constant *llvm::ConstantFoldInstruction(Instruction *I, const TargetData *TD) { if (const CmpInst *CI = dyn_cast<CmpInst>(I)) return ConstantFoldCompareInstOperands(CI->getPredicate(), - &Ops[0], Ops.size(), TD); + Ops.data(), Ops.size(), TD); else return ConstantFoldInstOperands(I->getOpcode(), I->getType(), - &Ops[0], Ops.size(), TD); + Ops.data(), Ops.size(), TD); } /// ConstantFoldConstantExpression - Attempt to fold the constant expression @@ -325,10 +325,10 @@ Constant *llvm::ConstantFoldConstantExpression(ConstantExpr *CE, if (CE->isCompare()) return ConstantFoldCompareInstOperands(CE->getPredicate(), - &Ops[0], Ops.size(), TD); + Ops.data(), Ops.size(), TD); else return ConstantFoldInstOperands(CE->getOpcode(), CE->getType(), - &Ops[0], Ops.size(), TD); + Ops.data(), Ops.size(), TD); } /// ConstantFoldInstOperands - Attempt to constant fold an instruction with the diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp index 9f6cbc9..6bdb64c 100644 --- a/lib/Analysis/DebugInfo.cpp +++ b/lib/Analysis/DebugInfo.cpp @@ -442,7 +442,7 @@ DIArray DIFactory::GetOrCreateArray(DIDescriptor *Tys, unsigned NumTys) { Constant *Init = ConstantArray::get(ArrayType::get(EmptyStructPtr, Elts.size()), - &Elts[0], Elts.size()); + Elts.data(), Elts.size()); // If we already have this array, just return the uniqued version. DIDescriptor &Entry = SimpleConstantCache[Init]; if (!Entry.isNull()) return DIArray(Entry.getGV()); |