diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-03-20 19:26:58 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-03-20 19:26:58 +0000 |
commit | a3bdc328a5ef1c915e897221aa29d17b0b7cb4d5 (patch) | |
tree | 2581e76ab5a372af5197d3b421f44562c5eeca7c /llvm/lib | |
parent | d4e07c973c6e02713ab330d6a8a4dd09520d76bd (diff) | |
download | bcm5719-llvm-a3bdc328a5ef1c915e897221aa29d17b0b7cb4d5.tar.gz bcm5719-llvm-a3bdc328a5ef1c915e897221aa29d17b0b7cb4d5.zip |
Verifier: Check that !dbg attachments have the right type
A WIP patch makes `DIDescriptor` accessors more strict, which in turn
causes the `DebugInfoFinder` to crash on wrongly typed `!dbg`
attachments. Catch that error up front in
`Verifier::visitInstruction()`.
Also remove a test that we "handle" invalid `!dbg` attachments, added
back in r99938. We don't want to handle those anymore.
Note: I'm *not* recursing and verifying the debug info graph reachable
from this node; that work is already done by `verifyDebugInfo()`.
llvm-svn: 232834
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/IR/Verifier.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index ce765b14420..4f0e3388d58 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -2556,6 +2556,13 @@ void Verifier::visitInstruction(Instruction &I) { &I); } + // Don't recurse into !dbg attachments (leave that for verifyDebugInfo()), + // but at least check that it's a legal type. + if (MDNode *N = I.getDebugLoc().getAsMDNode()) { + Assert(isa<MDLocation>(N), + "invalid !dbg metadata attachment", &I, N); + } + InstsInThisBlock.insert(&I); } |