diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-03-30 16:37:48 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-03-30 16:37:48 +0000 |
commit | 0e202b95c4fcdf87f330cb4c1df0916be94f0556 (patch) | |
tree | eb3f4971a67ad1fa7616cf45f42ec566b4122f08 /llvm/lib/IR/Verifier.cpp | |
parent | bcc4f121a33bcfdb2b367737e49fcec4d03a94ef (diff) | |
download | bcm5719-llvm-0e202b95c4fcdf87f330cb4c1df0916be94f0556.tar.gz bcm5719-llvm-0e202b95c4fcdf87f330cb4c1df0916be94f0556.zip |
Verifier: Add operand checks for MDLexicalBlock
Add operand checks for `MDLexicalBlock` and `MDLexicalBlockFile`. Like
`MDLocalVariable` and `MDLocation`, these nodes always require a scope.
There was no test bitrot to fix here (just updated the serialization
tests in test/Assembler/mdlexicalblock.ll).
llvm-svn: 233561
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
-rw-r--r-- | llvm/lib/IR/Verifier.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index e4aea237bfc..8d7040bad4d 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -302,6 +302,7 @@ private: void visitMDScope(const MDScope &N); void visitMDDerivedTypeBase(const MDDerivedTypeBase &N); void visitMDVariable(const MDVariable &N); + void visitMDLexicalBlockBase(const MDLexicalBlockBase &N); // InstVisitor overrides... using InstVisitor<Verifier>::visit; @@ -871,12 +872,21 @@ void Verifier::visitMDSubprogram(const MDSubprogram &N) { } } -void Verifier::visitMDLexicalBlock(const MDLexicalBlock &N) { +void Verifier::visitMDLexicalBlockBase(const MDLexicalBlockBase &N) { Assert(N.getTag() == dwarf::DW_TAG_lexical_block, "invalid tag", &N); + Assert(N.getRawScope() && isa<MDLocalScope>(N.getRawScope()), + "invalid local scope", &N, N.getRawScope()); +} + +void Verifier::visitMDLexicalBlock(const MDLexicalBlock &N) { + visitMDLexicalBlockBase(N); + + Assert(N.getLine() || !N.getColumn(), + "cannot have column info without line info", &N); } void Verifier::visitMDLexicalBlockFile(const MDLexicalBlockFile &N) { - Assert(N.getTag() == dwarf::DW_TAG_lexical_block, "invalid tag", &N); + visitMDLexicalBlockBase(N); } void Verifier::visitMDNamespace(const MDNamespace &N) { |