summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Verifier.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-03-31 01:28:58 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-03-31 01:28:58 +0000
commit85866b2a28d944f929b65de92ed9fc5aea035006 (patch)
treed7efc03010a1707c83e977652c6f7698e90f2f3b /llvm/lib/IR/Verifier.cpp
parent94d58f88801833c1d8d1bbc3d3f4244be9e2348d (diff)
downloadbcm5719-llvm-85866b2a28d944f929b65de92ed9fc5aea035006.tar.gz
bcm5719-llvm-85866b2a28d944f929b65de92ed9fc5aea035006.zip
Verifier: Check reference flags in debug info
Move over checks of `&` and `&&` flags. llvm-svn: 233658
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
-rw-r--r--llvm/lib/IR/Verifier.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 19897d4c030..171c16bc76b 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -796,6 +796,11 @@ void Verifier::visitMDDerivedType(const MDDerivedType &N) {
}
}
+static bool hasConflictingReferenceFlags(unsigned Flags) {
+ return (Flags & DebugNode::FlagLValueReference) &&
+ (Flags & DebugNode::FlagRValueReference);
+}
+
void Verifier::visitMDCompositeType(const MDCompositeType &N) {
// Common derived type checks.
visitMDDerivedTypeBase(N);
@@ -814,6 +819,8 @@ void Verifier::visitMDCompositeType(const MDCompositeType &N) {
N.getRawVTableHolder());
Assert(!N.getRawElements() || isa<MDTuple>(N.getRawElements()),
"invalid composite elements", &N, N.getRawElements());
+ Assert(!hasConflictingReferenceFlags(N.getFlags()), "invalid reference flags",
+ &N);
}
void Verifier::visitMDSubroutineType(const MDSubroutineType &N) {
@@ -824,6 +831,8 @@ void Verifier::visitMDSubroutineType(const MDSubroutineType &N) {
Assert(isTypeRef(Ty), "invalid subroutine type ref", &N, Types, Ty);
}
}
+ Assert(!hasConflictingReferenceFlags(N.getFlags()), "invalid reference flags",
+ &N);
}
void Verifier::visitMDFile(const MDFile &N) {
@@ -910,6 +919,8 @@ void Verifier::visitMDSubprogram(const MDSubprogram &N) {
Op);
}
}
+ Assert(!hasConflictingReferenceFlags(N.getFlags()), "invalid reference flags",
+ &N);
}
void Verifier::visitMDLexicalBlockBase(const MDLexicalBlockBase &N) {
OpenPOWER on IntegriCloud