[Debug Info] replace DIUnspecifiedParameter with DITrivialType.
This is the first of a series of patches to handle type uniqueing of the
type array for a subroutine type.
This commit makes sure unspecified_parameter is a DIType to enable converting
the type array for a subroutine type to an array of DITypes.
This commit should have no functionality change. With this commit, we may
change unspecified type to be a DITrivialType instead of a DIType.
llvm-svn: 214111
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index 5e39b24..8e05435 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -39,6 +39,7 @@
return DbgNode &&
(DIDerivedType(DbgNode).Verify() ||
DICompositeType(DbgNode).Verify() || DIBasicType(DbgNode).Verify() ||
+ DITrivialType(DbgNode).Verify() ||
DIVariable(DbgNode).Verify() || DISubprogram(DbgNode).Verify() ||
DIGlobalVariable(DbgNode).Verify() || DIFile(DbgNode).Verify() ||
DICompileUnit(DbgNode).Verify() || DINameSpace(DbgNode).Verify() ||
@@ -46,7 +47,6 @@
DILexicalBlockFile(DbgNode).Verify() ||
DISubrange(DbgNode).Verify() || DIEnumerator(DbgNode).Verify() ||
DIObjCProperty(DbgNode).Verify() ||
- DIUnspecifiedParameter(DbgNode).Verify() ||
DITemplateTypeParameter(DbgNode).Verify() ||
DITemplateValueParameter(DbgNode).Verify() ||
DIImportedEntity(DbgNode).Verify());
@@ -155,6 +155,10 @@
// Predicates
//===----------------------------------------------------------------------===//
+bool DIDescriptor::isTrivialType() const {
+ return DbgNode && getTag() == dwarf::DW_TAG_unspecified_parameters;
+}
+
/// isBasicType - Return true if the specified tag is legal for
/// DIBasicType.
bool DIDescriptor::isBasicType() const {
@@ -225,7 +229,8 @@
/// isType - Return true if the specified tag is legal for DIType.
bool DIDescriptor::isType() const {
- return isBasicType() || isCompositeType() || isDerivedType();
+ return isBasicType() || isCompositeType() || isDerivedType() ||
+ isTrivialType();
}
/// isSubprogram - Return true if the specified tag is legal for
@@ -456,7 +461,7 @@
// FIXME: Sink this into the various subclass verifies.
uint16_t Tag = getTag();
- if (!isBasicType() && Tag != dwarf::DW_TAG_const_type &&
+ if (!isBasicType() && !isTrivialType() && 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 &&
@@ -471,6 +476,8 @@
// a CompositeType.
if (isBasicType())
return DIBasicType(DbgNode).Verify();
+ else if (isTrivialType())
+ return DITrivialType(DbgNode).Verify();
else if (isCompositeType())
return DICompositeType(DbgNode).Verify();
else if (isDerivedType())
@@ -484,6 +491,10 @@
return isBasicType() && DbgNode->getNumOperands() == 10;
}
+bool DITrivialType::Verify() const {
+ return isTrivialType() && DbgNode->getNumOperands() == 1;
+}
+
/// Verify - Verify that a derived type descriptor is well formed.
bool DIDerivedType::Verify() const {
// Make sure DerivedFrom @ field 9 is TypeRef.
@@ -624,11 +635,6 @@
return isLexicalBlockFile() && DbgNode->getNumOperands() == 3;
}
-/// \brief Verify that an unspecified parameter descriptor is well formed.
-bool DIUnspecifiedParameter::Verify() const {
- return isUnspecifiedParameter() && DbgNode->getNumOperands() == 1;
-}
-
/// \brief Verify that the template type parameter descriptor is well formed.
bool DITemplateTypeParameter::Verify() const {
return isTemplateTypeParameter() && DbgNode->getNumOperands() == 7;
@@ -1290,7 +1296,7 @@
}
void DIType::printInternal(raw_ostream &OS) const {
- if (!DbgNode)
+ if (!DbgNode || isTrivialType())
return;
StringRef Res = getName();