[llvm] r243150 - Verifier: Sink filename check into visitMDCompositeType(), NFC
Duncan P. N. Exon Smith
dexonsmith at apple.com
Fri Jul 24 12:57:19 PDT 2015
Author: dexonsmith
Date: Fri Jul 24 14:57:19 2015
New Revision: 243150
URL: http://llvm.org/viewvc/llvm-project?rev=243150&view=rev
Log:
Verifier: Sink filename check into visitMDCompositeType(), NFC
We really only want to check this for unions and classes (all the other
tags have been ruled out), so simplify the check and move it to the
right place.
Modified:
llvm/trunk/lib/IR/Verifier.cpp
Modified: llvm/trunk/lib/IR/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=243150&r1=243149&r2=243150&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Verifier.cpp (original)
+++ llvm/trunk/lib/IR/Verifier.cpp Fri Jul 24 14:57:19 2015
@@ -786,25 +786,6 @@ void Verifier::visitDIDerivedTypeBase(co
Assert(isScopeRef(N, N.getScope()), "invalid scope", &N, N.getScope());
Assert(isTypeRef(N, N.getBaseType()), "invalid base type", &N,
N.getBaseType());
-
- // FIXME: Sink this into the subclass verifies.
- if (!N.getFile() || N.getFile()->getFilename().empty()) {
- // Check whether the filename is allowed to be empty.
- uint16_t Tag = N.getTag();
- Assert(
- Tag == dwarf::DW_TAG_const_type || Tag == dwarf::DW_TAG_volatile_type ||
- Tag == dwarf::DW_TAG_pointer_type ||
- Tag == dwarf::DW_TAG_ptr_to_member_type ||
- Tag == dwarf::DW_TAG_reference_type ||
- Tag == dwarf::DW_TAG_rvalue_reference_type ||
- Tag == dwarf::DW_TAG_restrict_type ||
- Tag == dwarf::DW_TAG_array_type ||
- Tag == dwarf::DW_TAG_enumeration_type ||
- Tag == dwarf::DW_TAG_inheritance || Tag == dwarf::DW_TAG_friend ||
- Tag == dwarf::DW_TAG_structure_type ||
- Tag == dwarf::DW_TAG_member || Tag == dwarf::DW_TAG_typedef,
- "derived/composite type requires a filename", &N, N.getFile());
- }
}
void Verifier::visitDIDerivedType(const DIDerivedType &N) {
@@ -864,6 +845,12 @@ void Verifier::visitDICompositeType(cons
&N);
if (auto *Params = N.getRawTemplateParams())
visitTemplateParams(N, *Params);
+
+ if (N.getTag() == dwarf::DW_TAG_class_type ||
+ N.getTag() == dwarf::DW_TAG_union_type) {
+ Assert(N.getFile() && !N.getFile()->getFilename().empty(),
+ "class/union requires a filename", &N, N.getFile());
+ }
}
void Verifier::visitDISubroutineType(const DISubroutineType &N) {
More information about the llvm-commits
mailing list