diff options
| -rw-r--r-- | llvm/include/llvm/IR/DebugInfoMetadata.h | 1 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp | 7 | ||||
| -rw-r--r-- | llvm/lib/IR/DIBuilder.cpp | 4 | ||||
| -rw-r--r-- | llvm/test/DebugInfo/2010-10-01-crash.ll | 2 |
4 files changed, 5 insertions, 9 deletions
diff --git a/llvm/include/llvm/IR/DebugInfoMetadata.h b/llvm/include/llvm/IR/DebugInfoMetadata.h index 98d5c2e2f7c..eeacbdbf343 100644 --- a/llvm/include/llvm/IR/DebugInfoMetadata.h +++ b/llvm/include/llvm/IR/DebugInfoMetadata.h @@ -99,6 +99,7 @@ class DITypeRefArray { const MDTuple *N = nullptr; public: + DITypeRefArray() = default; DITypeRefArray(const MDTuple *N) : N(N) {} explicit operator bool() const { return get(); } diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index d5ed0cd0945..d3e0b8b798c 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -1195,11 +1195,10 @@ void DwarfUnit::applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie, Language == dwarf::DW_LANG_ObjC)) addFlag(SPDie, dwarf::DW_AT_prototyped); - const DISubroutineType *SPTy = SP->getType(); - assert(SPTy->getTag() == dwarf::DW_TAG_subroutine_type && - "the type of a subprogram should be a subroutine"); + DITypeRefArray Args; + if (const DISubroutineType *SPTy = SP->getType()) + Args = SPTy->getTypeArray(); - auto Args = SPTy->getTypeArray(); // Add a return type. If this is a type like a C/C++ void type we don't add a // return type. if (Args.size()) diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp index d1257ce78df..aedddb98330 100644 --- a/llvm/lib/IR/DIBuilder.cpp +++ b/llvm/lib/IR/DIBuilder.cpp @@ -689,8 +689,6 @@ DISubprogram *DIBuilder::createFunction(DIScope *Context, StringRef Name, unsigned ScopeLine, unsigned Flags, bool isOptimized, Function *Fn, MDNode *TParams, MDNode *Decl) { - assert(Ty->getTag() == dwarf::DW_TAG_subroutine_type && - "function types should be subroutines"); auto *Node = getSubprogram(/* IsDistinct = */ isDefinition, VMContext, DIScopeRef::get(getNonCompileUnitScope(Context)), Name, LinkageName, File, LineNo, Ty, isLocalToUnit, @@ -725,8 +723,6 @@ DIBuilder::createMethod(DIScope *Context, StringRef Name, StringRef LinkageName, bool isLocalToUnit, bool isDefinition, unsigned VK, unsigned VIndex, DIType *VTableHolder, unsigned Flags, bool isOptimized, Function *Fn, MDNode *TParam) { - assert(Ty->getTag() == dwarf::DW_TAG_subroutine_type && - "function types should be subroutines"); assert(getNonCompileUnitScope(Context) && "Methods should have both a Context and a context that isn't " "the compile unit."); diff --git a/llvm/test/DebugInfo/2010-10-01-crash.ll b/llvm/test/DebugInfo/2010-10-01-crash.ll index 914e300c346..6ae48f1c408 100644 --- a/llvm/test/DebugInfo/2010-10-01-crash.ll +++ b/llvm/test/DebugInfo/2010-10-01-crash.ll @@ -15,7 +15,7 @@ declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, !llvm.module.flags = !{!27} !0 = distinct !DISubprogram(name: "CGRectStandardize", linkageName: "CGRectStandardize", line: 54, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, file: !1, scope: null, function: void (i32*, i32*)* @CGRectStandardize) !1 = !DIFile(filename: "GSFusedSilica.m", directory: "/Volumes/Data/Users/sabre/Desktop") -!2 = distinct !DICompileUnit(language: DW_LANG_ObjC, producer: "clang version 2.9 (trunk 115292)", isOptimized: true, runtimeVersion: 1, emissionKind: 0, file: !25, enums: !26, retainedTypes: !26) +!2 = distinct !DICompileUnit(language: DW_LANG_ObjC, producer: "clang version 2.9 (trunk 115292)", isOptimized: true, runtimeVersion: 1, emissionKind: 0, file: !25, enums: !26, retainedTypes: !26, subprograms: !{!0}) !5 = !DIDerivedType(tag: DW_TAG_typedef, name: "CGRect", line: 49, file: !25, baseType: null) !23 = !DILocalVariable(name: "rect", line: 53, arg: 2, scope: !0, file: !1, type: !5) !24 = !DILocation(line: 53, column: 33, scope: !0) |

