summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/DIBuilder.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-03-30 16:19:15 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-03-30 16:19:15 +0000
commit869db50ffd931af466d85ca751a4843fc8aa15bf (patch)
tree82aa6ac5f6ef61c4b1ddb36c2b8871d7e505e5a6 /llvm/lib/IR/DIBuilder.cpp
parentd1fdbe7c3266c1a2876dd4a628c881ddf62e0149 (diff)
downloadbcm5719-llvm-869db50ffd931af466d85ca751a4843fc8aa15bf.tar.gz
bcm5719-llvm-869db50ffd931af466d85ca751a4843fc8aa15bf.zip
Verifier: Check operands of MDSubprogram nodes
Check operands of `MDSubprogram`s in the verifier, and update the accessors and factory functions to use more specific types. There were a lot of broken testcases, which I fixed in r233466. If you have out-of-tree tests for debug info, you probably need similar changes to the ones I made there. llvm-svn: 233559
Diffstat (limited to 'llvm/lib/IR/DIBuilder.cpp')
-rw-r--r--llvm/lib/IR/DIBuilder.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp
index dfbc1315218..28d27d201c0 100644
--- a/llvm/lib/IR/DIBuilder.cpp
+++ b/llvm/lib/IR/DIBuilder.cpp
@@ -674,9 +674,11 @@ DISubprogram DIBuilder::createFunction(DIDescriptor Context, StringRef Name,
"function types should be subroutines");
auto *Node = MDSubprogram::get(
VMContext, DIScope(getNonCompileUnitScope(Context)).getRef(), Name,
- LinkageName, File.getFileNode(), LineNo, Ty, isLocalToUnit, isDefinition,
- ScopeLine, nullptr, 0, 0, Flags, isOptimized, getConstantOrNull(Fn),
- TParams, Decl, MDNode::getTemporary(VMContext, None).release());
+ LinkageName, File.get(), LineNo, cast_or_null<MDSubroutineType>(Ty.get()),
+ isLocalToUnit, isDefinition, ScopeLine, nullptr, 0, 0, Flags, isOptimized,
+ getConstantOrNull(Fn), cast_or_null<MDTuple>(TParams),
+ cast_or_null<MDSubprogram>(Decl),
+ MDTuple::getTemporary(VMContext, None).release());
if (isDefinition)
AllSubprograms.push_back(Node);
@@ -694,9 +696,11 @@ DIBuilder::createTempFunctionFwdDecl(DIDescriptor Context, StringRef Name,
MDNode *TParams, MDNode *Decl) {
return MDSubprogram::getTemporary(
VMContext, DIScope(getNonCompileUnitScope(Context)).getRef(), Name,
- LinkageName, File.getFileNode(), LineNo, Ty, isLocalToUnit,
+ LinkageName, File.get(), LineNo,
+ cast_or_null<MDSubroutineType>(Ty.get()), isLocalToUnit,
isDefinition, ScopeLine, nullptr, 0, 0, Flags, isOptimized,
- getConstantOrNull(Fn), TParams, Decl, nullptr).release();
+ getConstantOrNull(Fn), cast_or_null<MDTuple>(TParams),
+ cast_or_null<MDSubprogram>(Decl), nullptr).release();
}
DISubprogram DIBuilder::createMethod(DIDescriptor Context, StringRef Name,
@@ -714,10 +718,10 @@ DISubprogram DIBuilder::createMethod(DIDescriptor Context, StringRef Name,
"the compile unit.");
// FIXME: Do we want to use different scope/lines?
auto *Node = MDSubprogram::get(
- VMContext, DIScope(Context).getRef(), Name, LinkageName, F.getFileNode(),
- LineNo, Ty, isLocalToUnit, isDefinition, LineNo, VTableHolder.getRef(),
- VK, VIndex, Flags, isOptimized, getConstantOrNull(Fn), TParam, nullptr,
- nullptr);
+ VMContext, DIScope(Context).getRef(), Name, LinkageName, F.get(), LineNo,
+ cast_or_null<MDSubroutineType>(Ty.get()), isLocalToUnit, isDefinition,
+ LineNo, VTableHolder.getRef(), VK, VIndex, Flags, isOptimized,
+ getConstantOrNull(Fn), cast_or_null<MDTuple>(TParam), nullptr, nullptr);
if (isDefinition)
AllSubprograms.push_back(Node);
OpenPOWER on IntegriCloud