diff options
| author | Davide Italiano <davide@freebsd.org> | 2017-09-24 01:06:35 +0000 |
|---|---|---|
| committer | Davide Italiano <davide@freebsd.org> | 2017-09-24 01:06:35 +0000 |
| commit | 212211915096b22f5dfa32cc554aadaf17fb8ba4 (patch) | |
| tree | 26c7cbe4c6f2dce7d7022662e838cbaff905e1ba /llvm/lib/IR | |
| parent | 026727f861c8187c92aa1eb7598691029f64fe33 (diff) | |
| download | bcm5719-llvm-212211915096b22f5dfa32cc554aadaf17fb8ba4.tar.gz bcm5719-llvm-212211915096b22f5dfa32cc554aadaf17fb8ba4.zip | |
[Verifier] Stop accepting broken DIGlobalVariable(s).
The code wasn't yelling at the user when there's a reference
from a DIGlobalVariableExpression. Thanks to Adrian for the
reduced testcase. Fixes PR34672.
llvm-svn: 314069
Diffstat (limited to 'llvm/lib/IR')
| -rw-r--r-- | llvm/lib/IR/Verifier.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index 19d8c2a66a8..57559356f4d 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -1146,7 +1146,6 @@ void Verifier::visitDITemplateValueParameter( void Verifier::visitDIVariable(const DIVariable &N) { if (auto *S = N.getRawScope()) AssertDI(isa<DIScope>(S), "invalid scope", &N, S); - AssertDI(isType(N.getRawType()), "invalid type ref", &N, N.getRawType()); if (auto *F = N.getRawFile()) AssertDI(isa<DIFile>(F), "invalid file", &N, F); } @@ -1169,6 +1168,7 @@ void Verifier::visitDILocalVariable(const DILocalVariable &N) { // Checks common to all variables. visitDIVariable(N); + AssertDI(isType(N.getRawType()), "invalid type ref", &N, N.getRawType()); AssertDI(N.getTag() == dwarf::DW_TAG_variable, "invalid tag", &N); AssertDI(N.getRawScope() && isa<DILocalScope>(N.getRawScope()), "local variable requires a valid scope", &N, N.getRawScope()); @@ -1181,6 +1181,8 @@ void Verifier::visitDIExpression(const DIExpression &N) { void Verifier::visitDIGlobalVariableExpression( const DIGlobalVariableExpression &GVE) { AssertDI(GVE.getVariable(), "missing variable"); + if (auto *Var = GVE.getVariable()) + visitDIGlobalVariable(*Var); if (auto *Expr = GVE.getExpression()) { visitDIExpression(*Expr); if (auto Fragment = Expr->getFragmentInfo()) |

