[llvm] r265586 - [IRVerifier] Don't crash on invalid DIFile inside DISubprogram.
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 6 11:46:40 PDT 2016
Author: davide
Date: Wed Apr 6 13:46:39 2016
New Revision: 265586
URL: http://llvm.org/viewvc/llvm-project?rev=265586&view=rev
Log:
[IRVerifier] Don't crash on invalid DIFile inside DISubprogram.
r265515, this time with the correct fix. file inside DISubprogram is not
mandatory.
Added:
llvm/trunk/test/Verifier/dbg-difile-crash.ll
Modified:
llvm/trunk/lib/IR/Verifier.cpp
Modified: llvm/trunk/lib/IR/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=265586&r1=265585&r2=265586&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Verifier.cpp (original)
+++ llvm/trunk/lib/IR/Verifier.cpp Wed Apr 6 13:46:39 2016
@@ -988,6 +988,8 @@ void Verifier::visitDICompileUnit(const
void Verifier::visitDISubprogram(const DISubprogram &N) {
Assert(N.getTag() == dwarf::DW_TAG_subprogram, "invalid tag", &N);
Assert(isScopeRef(N, N.getRawScope()), "invalid scope", &N, N.getRawScope());
+ if (auto *F = N.getRawFile())
+ Assert(isa<DIFile>(F), "invalid file", &N, F);
if (auto *T = N.getRawType())
Assert(isa<DISubroutineType>(T), "invalid subroutine type", &N, T);
Assert(isTypeRef(N, N.getRawContainingType()), "invalid containing type", &N,
Added: llvm/trunk/test/Verifier/dbg-difile-crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Verifier/dbg-difile-crash.ll?rev=265586&view=auto
==============================================================================
--- llvm/trunk/test/Verifier/dbg-difile-crash.ll (added)
+++ llvm/trunk/test/Verifier/dbg-difile-crash.ll Wed Apr 6 13:46:39 2016
@@ -0,0 +1,10 @@
+; RUN: not llvm-as -disable-output <%s 2>&1 | FileCheck %s
+; CHECK: assembly parsed, but does not verify
+; CHECK-NEXT: invalid file
+
+!llvm.module.flags = !{!0}
+!0 = !{i32 2, !"Debug Info Version", i32 3}
+!llvm.dbg.cu = !{!1}
+!1 = distinct !DICompileUnit(file: !2, language: DW_LANG_C99, subprograms: !{!3})
+!2 = !DIFile(filename: "file.c", directory: "/path/to/dir")
+!3 = distinct !DISubprogram(name: "blah", file: !1)
More information about the llvm-commits
mailing list