summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Verifier.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2015-01-21 00:59:20 +0000
committerAdrian Prantl <aprantl@apple.com>2015-01-21 00:59:20 +0000
commit34bcbeed03584aa9785df3b7c138341024c21257 (patch)
treea603302f274370f0e010a5b48fcb537cbf080e5c /llvm/lib/IR/Verifier.cpp
parent1efd55ff21eb3f9c2b94ddb7b97e316d0b926b64 (diff)
downloadbcm5719-llvm-34bcbeed03584aa9785df3b7c138341024c21257.tar.gz
bcm5719-llvm-34bcbeed03584aa9785df3b7c138341024c21257.zip
Make DIExpression::Verify() stricter by checking that the number of
elements and the ordering is sane and cleanup the accessors. llvm-svn: 226627
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
-rw-r--r--llvm/lib/IR/Verifier.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index c95018d1772..8a523c28016 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -2841,12 +2841,20 @@ void DebugInfoVerifier::processCallInst(DebugInfoFinder &Finder,
if (Function *F = CI.getCalledFunction())
if (Intrinsic::ID ID = (Intrinsic::ID)F->getIntrinsicID())
switch (ID) {
- case Intrinsic::dbg_declare:
- Finder.processDeclare(*M, cast<DbgDeclareInst>(&CI));
+ case Intrinsic::dbg_declare: {
+ auto *DDI = cast<DbgDeclareInst>(&CI);
+ Finder.processDeclare(*M, DDI);
+ if (auto E = DDI->getExpression())
+ Assert1(DIExpression(E).Verify(), "DIExpression does not Verify!", E);
break;
- case Intrinsic::dbg_value:
- Finder.processValue(*M, cast<DbgValueInst>(&CI));
+ }
+ case Intrinsic::dbg_value: {
+ auto *DVI = cast<DbgValueInst>(&CI);
+ Finder.processValue(*M, DVI);
+ if (auto E = DVI->getExpression())
+ Assert1(DIExpression(E).Verify(), "DIExpression does not Verify!", E);
break;
+ }
default:
break;
}
OpenPOWER on IntegriCloud