summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/DebugInfo.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-03-16 20:46:27 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-03-16 20:46:27 +0000
commitf37404033fb0d5097a0c5e361ce3a1c6a5575960 (patch)
treebaa4de0d0a2e4cf5bb84a318cb881004af0e7bee /llvm/lib/IR/DebugInfo.cpp
parent01d73c967895865ce9a9601244ac7daa8b4ba7d1 (diff)
downloadbcm5719-llvm-f37404033fb0d5097a0c5e361ce3a1c6a5575960.tar.gz
bcm5719-llvm-f37404033fb0d5097a0c5e361ce3a1c6a5575960.zip
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. llvm-svn: 232410
Diffstat (limited to 'llvm/lib/IR/DebugInfo.cpp')
-rw-r--r--llvm/lib/IR/DebugInfo.cpp38
1 files changed, 20 insertions, 18 deletions
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index 3db74fcee58..148fa2101c0 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -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(); }
OpenPOWER on IntegriCloud