[llvm] r232410 - DebugInfo: Simplify logic in DIType::Verify(), NFC
Duncan P. N. Exon Smith
dexonsmith at apple.com
Mon Mar 16 13:46:27 PDT 2015
Author: dexonsmith
Date: Mon Mar 16 15:46:27 2015
New Revision: 232410
URL: http://llvm.org/viewvc/llvm-project?rev=232410&view=rev
Log:
DebugInfo: Simplify logic in DIType::Verify(), NFC
Clarify the logic in `DIType::Verify()` by checking `isBasicType()`
earlier, by skipping `else` after `return`s, and by documenting an
otherwise opaque check.
No functionality change.
Modified:
llvm/trunk/lib/IR/DebugInfo.cpp
Modified: llvm/trunk/lib/IR/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=232410&r1=232409&r2=232410&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfo.cpp Mon Mar 16 15:46:27 2015
@@ -266,30 +266,32 @@ bool DIType::Verify() const {
if (!isScopeRef(N->getScope()))
return false;
- // FIXME: Sink this into the various subclass verifies.
- uint16_t Tag = getTag();
- if (!isBasicType() && 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_subroutine_type &&
- Tag != dwarf::DW_TAG_inheritance && Tag != dwarf::DW_TAG_friend &&
- getFilename().empty())
- return false;
-
// DIType is abstract, it should be a BasicType, a DerivedType or
// a CompositeType.
if (isBasicType())
return DIBasicType(DbgNode).Verify();
- else if (isCompositeType())
+
+ // FIXME: Sink this into the various subclass verifies.
+ if (getFilename().empty()) {
+ // Check whether the filename is allowed to be empty.
+ uint16_t Tag = getTag();
+ if (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_subroutine_type &&
+ Tag != dwarf::DW_TAG_inheritance && Tag != dwarf::DW_TAG_friend)
+ return false;
+ }
+
+ if (isCompositeType())
return DICompositeType(DbgNode).Verify();
- else if (isDerivedType())
+ if (isDerivedType())
return DIDerivedType(DbgNode).Verify();
- else
- return false;
+ return false;
}
bool DIBasicType::Verify() const { return getRaw(); }
More information about the llvm-commits
mailing list