diff options
| -rw-r--r-- | llvm/lib/IR/Verifier.cpp | 6 | ||||
| -rw-r--r-- | llvm/test/Verifier/dbg.ll | 10 |
2 files changed, 10 insertions, 6 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index d5a5afa0c40..5f25891f2b1 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -2567,11 +2567,9 @@ 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); + Assert(isa<MDLocation>(N), "invalid !dbg metadata attachment", &I, N); + visitMDNode(*N); } InstsInThisBlock.insert(&I); diff --git a/llvm/test/Verifier/dbg.ll b/llvm/test/Verifier/dbg.ll index 20b80ff2efe..3cff1e05157 100644 --- a/llvm/test/Verifier/dbg.ll +++ b/llvm/test/Verifier/dbg.ll @@ -1,12 +1,18 @@ ; RUN: not llvm-as -disable-output <%s 2>&1 | FileCheck %s define void @foo() { - ret void, !dbg !{} -} +entry: + br label %exit, !dbg !MDLocation(scope: !MDSubprogram(), inlinedAt: !{}) +; CHECK: inlined-at should be a location +; CHECK-NEXT: !{{[0-9]+}} = !MDLocation(line: 0, scope: !{{[0-9]+}}, inlinedAt: ![[IA:[0-9]+]]) +; CHECK-NEXT: ![[IA]] = !{} +exit: + ret void, !dbg !{} ; CHECK: invalid !dbg metadata attachment ; CHECK-NEXT: ret void, !dbg ![[LOC:[0-9]+]] ; CHECK-NEXT: ![[LOC]] = !{} +} !llvm.module.flags = !{!0} !0 = !{i32 2, !"Debug Info Version", i32 3} |

