summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Verifier.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-03-30 16:37:48 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-03-30 16:37:48 +0000
commit0e202b95c4fcdf87f330cb4c1df0916be94f0556 (patch)
treeeb3f4971a67ad1fa7616cf45f42ec566b4122f08 /llvm/lib/IR/Verifier.cpp
parentbcc4f121a33bcfdb2b367737e49fcec4d03a94ef (diff)
downloadbcm5719-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.cpp14
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) {
OpenPOWER on IntegriCloud