summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Verifier.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-03-28 02:43:53 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-03-28 02:43:53 +0000
commita8b3a1f374598c97d3fb52e95f81d17a3b78514f (patch)
treeb2e259e17261f2754f13803db9fde1494f30915b /llvm/lib/IR/Verifier.cpp
parentd989386f74c7ffcc346bdda9cbf651a5b5420186 (diff)
downloadbcm5719-llvm-a8b3a1f374598c97d3fb52e95f81d17a3b78514f.tar.gz
bcm5719-llvm-a8b3a1f374598c97d3fb52e95f81d17a3b78514f.zip
Verifier: Allow subroutine types to have no type array
Loosen one check from r233446: as long as `DIBuilder` requires a non-null type for every subprogram, we should allow a null type array. Also add tests for the rest of `MDSubroutineType`, which were somehow missing. llvm-svn: 233468
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
-rw-r--r--llvm/lib/IR/Verifier.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index b2a86e27b75..af79984f59a 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -758,12 +758,11 @@ void Verifier::visitMDCompositeType(const MDCompositeType &N) {
void Verifier::visitMDSubroutineType(const MDSubroutineType &N) {
Assert(N.getTag() == dwarf::DW_TAG_subroutine_type, "invalid tag", &N);
- Assert(N.getRawElements() && isa<MDTuple>(N.getRawElements()),
- "invalid composite elements", &N, N.getRawElements());
-
- for (Metadata *Ty : N.getTypeArray()->operands()) {
- Assert(isTypeRef(Ty), "invalid subroutine type ref", &N, N.getTypeArray(),
- Ty);
+ if (auto *Types = N.getRawTypeArray()) {
+ Assert(isa<MDTuple>(Types), "invalid composite elements", &N, Types);
+ for (Metadata *Ty : N.getTypeArray()->operands()) {
+ Assert(isTypeRef(Ty), "invalid subroutine type ref", &N, Types, Ty);
+ }
}
}
OpenPOWER on IntegriCloud