diff options
| author | Manman Ren <manman.ren@gmail.com> | 2014-07-29 18:20:39 +0000 |
|---|---|---|
| committer | Manman Ren <manman.ren@gmail.com> | 2014-07-29 18:20:39 +0000 |
| commit | f93ac4bfadc705760853c3bcb6463b1d58c7d1dc (patch) | |
| tree | dc3888dbb8062675ae437f96aafdca67b762e47d /llvm/lib | |
| parent | a3a6c12c0315d03fd8139606793b0d22ef2a57f6 (diff) | |
| download | bcm5719-llvm-f93ac4bfadc705760853c3bcb6463b1d58c7d1dc.tar.gz bcm5719-llvm-f93ac4bfadc705760853c3bcb6463b1d58c7d1dc.zip | |
[Debug Info] remove DITrivialType and use null to represent unspecified param.
Per feedback on r214111, we are going to use null to represent unspecified
parameter. If the type array is {null}, it means a function that returns void;
If the type array is {null, null}, it means a variadic function that returns
void. In summary if we have more than one element in the type array and the last
element is null, it is a variadic function.
rdar://17628609
llvm-svn: 214189
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 8 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp | 4 | ||||
| -rw-r--r-- | llvm/lib/IR/DIBuilder.cpp | 7 | ||||
| -rw-r--r-- | llvm/lib/IR/DebugInfo.cpp | 24 |
4 files changed, 12 insertions, 31 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index d58e47eaf03..d0958c0e975 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -469,11 +469,13 @@ DIE *DwarfDebug::createScopeChildrenDIE( // If this is a variadic function, add an unspecified parameter. DISubprogram SP(Scope->getScopeNode()); DITypeArray FnArgs = SP.getType().getTypeArray(); - if (resolve(FnArgs.getElement(FnArgs.getNumElements() - 1)) - .isUnspecifiedParameter()) { + // If we have a single element of null, it is a function that returns void. + // If we have more than one elements and the last one is null, it is a + // variadic function. + if (FnArgs.getNumElements() > 1 && + !resolve(FnArgs.getElement(FnArgs.getNumElements() - 1))) Children.push_back( make_unique<DIE>(dwarf::DW_TAG_unspecified_parameters)); - } } // Collect lexical scope children first. diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index 43c6de5b0c3..f49eaca8c23 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -1132,7 +1132,7 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, DIDerivedType DTy) { void DwarfUnit::constructSubprogramArguments(DIE &Buffer, DITypeArray Args) { for (unsigned i = 1, N = Args.getNumElements(); i < N; ++i) { DIType Ty = resolve(Args.getElement(i)); - if (Ty.isUnspecifiedParameter()) { + if (!Ty) { assert(i == N-1 && "Unspecified parameter must be the last argument"); createAndAddDIE(dwarf::DW_TAG_unspecified_parameters, Buffer); } else { @@ -1168,7 +1168,7 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, DICompositeType CTy) { bool isPrototyped = true; if (Elements.getNumElements() == 2 && - resolve(Elements.getElement(1)).isUnspecifiedParameter()) + !resolve(Elements.getElement(1))) isPrototyped = false; constructSubprogramArguments(Buffer, Elements); diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp index 16ff8a07570..2903b9d3453 100644 --- a/llvm/lib/IR/DIBuilder.cpp +++ b/llvm/lib/IR/DIBuilder.cpp @@ -875,11 +875,8 @@ void DIBuilder::retainType(DIType T) { /// createUnspecifiedParameter - Create unspeicified type descriptor /// for the subroutine type. -DITrivialType DIBuilder::createUnspecifiedParameter() { - Value *Elts[] = { - GetTagConstant(VMContext, dwarf::DW_TAG_unspecified_parameters) - }; - return DITrivialType(MDNode::get(VMContext, Elts)); +DIBasicType DIBuilder::createUnspecifiedParameter() { + return DIBasicType(nullptr); } /// createForwardDecl - Create a temporary forward-declared type that diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index b97358545a5..b08755ed707 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -39,7 +39,6 @@ bool DIDescriptor::Verify() const { 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() || @@ -155,10 +154,6 @@ MDNode *DIVariable::getInlinedAt() const { return getNodeField(DbgNode, 7); } // Predicates //===----------------------------------------------------------------------===// -bool DIDescriptor::isTrivialType() const { - return DbgNode && getTag() == dwarf::DW_TAG_unspecified_parameters; -} - bool DIDescriptor::isSubroutineType() const { return isCompositeType() && getTag() == dwarf::DW_TAG_subroutine_type; } @@ -233,8 +228,7 @@ bool DIDescriptor::isVariable() const { /// isType - Return true if the specified tag is legal for DIType. bool DIDescriptor::isType() const { - return isBasicType() || isCompositeType() || isDerivedType() || - isTrivialType(); + return isBasicType() || isCompositeType() || isDerivedType(); } /// isSubprogram - Return true if the specified tag is legal for @@ -250,12 +244,6 @@ bool DIDescriptor::isGlobalVariable() const { getTag() == dwarf::DW_TAG_constant); } -/// isUnspecifiedParmeter - Return true if the specified tag is -/// DW_TAG_unspecified_parameters. -bool DIDescriptor::isUnspecifiedParameter() const { - return DbgNode && getTag() == dwarf::DW_TAG_unspecified_parameters; -} - /// isScope - Return true if the specified tag is one of the scope /// related tag. bool DIDescriptor::isScope() const { @@ -459,7 +447,7 @@ bool DIType::Verify() const { // FIXME: Sink this into the various subclass verifies. uint16_t Tag = getTag(); - if (!isBasicType() && !isTrivialType() && Tag != dwarf::DW_TAG_const_type && + 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 && @@ -474,8 +462,6 @@ bool DIType::Verify() const { // 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()) @@ -489,10 +475,6 @@ bool DIBasicType::Verify() const { 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. @@ -1297,7 +1279,7 @@ void DIEnumerator::printInternal(raw_ostream &OS) const { } void DIType::printInternal(raw_ostream &OS) const { - if (!DbgNode || isTrivialType()) + if (!DbgNode) return; StringRef Res = getName(); |

