diff --git a/include/llvm/DIBuilder.h b/include/llvm/DIBuilder.h index a15d619097e..941ed046883 100644 --- a/include/llvm/DIBuilder.h +++ b/include/llvm/DIBuilder.h @@ -419,9 +419,11 @@ namespace llvm { DIType createObjectPointerType(DIType Ty); /// createForwardDecl - Create a temporary forward-declared type. - DIType createForwardDecl(unsigned Tag, StringRef Name, DIDescriptor Scope, - DIFile F, unsigned Line, unsigned RuntimeLang = 0, - uint64_t SizeInBits = 0, uint64_t AlignInBits = 0); + DICompositeType createForwardDecl(unsigned Tag, StringRef Name, + DIDescriptor Scope, DIFile F, + unsigned Line, unsigned RuntimeLang = 0, + uint64_t SizeInBits = 0, + uint64_t AlignInBits = 0); /// retainType - Retain DIType in a module even if it is not referenced /// through debug info anchors. diff --git a/include/llvm/DebugInfo.h b/include/llvm/DebugInfo.h index b02446abbbf..2efc730f09d 100644 --- a/include/llvm/DebugInfo.h +++ b/include/llvm/DebugInfo.h @@ -323,7 +323,7 @@ namespace llvm { DIArray getTypeArray() const { return getFieldAs(10); } void setTypeArray(DIArray Elements, DIArray TParams = DIArray()); - void addMember(DISubprogram S); + void addMember(DIDescriptor D); unsigned getRunTimeLang() const { return getUnsignedField(11); } DICompositeType getContainingType() const { return getFieldAs(12); diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 803a35d9e4c..3d2c1b8868e 100644 --- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -981,9 +981,6 @@ void CompileUnit::constructTypeDIE(DIE &Buffer, DICompositeType CTy) { case dwarf::DW_TAG_structure_type: case dwarf::DW_TAG_union_type: case dwarf::DW_TAG_class_type: { - if (CTy.isForwardDecl()) - break; - // Add elements to structure type. DIArray Elements = CTy.getTypeArray(); for (unsigned i = 0, N = Elements.getNumElements(); i < N; ++i) { diff --git a/lib/IR/DIBuilder.cpp b/lib/IR/DIBuilder.cpp index e36d0288992..665e16ea8a7 100644 --- a/lib/IR/DIBuilder.cpp +++ b/lib/IR/DIBuilder.cpp @@ -844,7 +844,7 @@ DIDescriptor DIBuilder::createUnspecifiedParameter() { /// createForwardDecl - Create a temporary forward-declared type that /// can be RAUW'd if the full type is seen. -DIType DIBuilder::createForwardDecl(unsigned Tag, StringRef Name, +DICompositeType DIBuilder::createForwardDecl(unsigned Tag, StringRef Name, DIDescriptor Scope, DIFile F, unsigned Line, unsigned RuntimeLang, uint64_t SizeInBits, @@ -863,11 +863,12 @@ DIType DIBuilder::createForwardDecl(unsigned Tag, StringRef Name, DIDescriptor::FlagFwdDecl), NULL, DIArray(), - ConstantInt::get(Type::getInt32Ty(VMContext), RuntimeLang) + ConstantInt::get(Type::getInt32Ty(VMContext), RuntimeLang), + NULL }; MDNode *Node = MDNode::getTemporary(VMContext, Elts); - DIType RetTy(Node); - assert(RetTy.isType() && + DICompositeType RetTy(Node); + assert(RetTy.isCompositeType() && "createForwardDecl result should be a DIType"); return RetTy; } diff --git a/lib/IR/DebugInfo.cpp b/lib/IR/DebugInfo.cpp index 0f7ddb5961c..cffc2ac1f22 100644 --- a/lib/IR/DebugInfo.cpp +++ b/lib/IR/DebugInfo.cpp @@ -647,7 +647,7 @@ void DICompositeType::setTypeArray(DIArray Elements, DIArray TParams) { DbgNode = N; } -void DICompositeType::addMember(DISubprogram S) { +void DICompositeType::addMember(DIDescriptor D) { SmallVector M; DIArray OrigM = getTypeArray(); unsigned Elements = OrigM.getNumElements(); @@ -656,7 +656,7 @@ void DICompositeType::addMember(DISubprogram S) { M.reserve(Elements + 1); for (unsigned i = 0; i != Elements; ++i) M.push_back(OrigM.getElement(i)); - M.push_back(S); + M.push_back(D); setTypeArray(DIArray(MDNode::get(DbgNode->getContext(), M))); }