summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Verifier.cpp
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2017-02-17 23:57:42 +0000
committerJustin Bogner <mail@justinbogner.com>2017-02-17 23:57:42 +0000
commitefc3fbf6a2015464d8f2773b7003f64190d17c31 (patch)
tree01c5161fecce6263076b13eb46eac99983ff3662 /llvm/lib/IR/Verifier.cpp
parent34b1fd6aaaf7e31ddcf65437ba8e274fe79bb7d2 (diff)
downloadbcm5719-llvm-efc3fbf6a2015464d8f2773b7003f64190d17c31.tar.gz
bcm5719-llvm-efc3fbf6a2015464d8f2773b7003f64190d17c31.zip
Verifier: Disallow a line number without a file in DISubprogram
A line number doesn't make much sense if you don't say where it's from. Add a verifier check for this and update some tests that had bogus debug info. llvm-svn: 295516
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
-rw-r--r--llvm/lib/IR/Verifier.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 41593af000c..9c2da10c9e1 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -1025,6 +1025,8 @@ void Verifier::visitDISubprogram(const DISubprogram &N) {
AssertDI(isScope(N.getRawScope()), "invalid scope", &N, N.getRawScope());
if (auto *F = N.getRawFile())
AssertDI(isa<DIFile>(F), "invalid file", &N, F);
+ else
+ AssertDI(N.getLine() == 0, "line specified with no file", &N, N.getLine());
if (auto *T = N.getRawType())
AssertDI(isa<DISubroutineType>(T), "invalid subroutine type", &N, T);
AssertDI(isType(N.getRawContainingType()), "invalid containing type", &N,
OpenPOWER on IntegriCloud