diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-11-05 18:16:03 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-11-05 18:16:03 +0000 |
commit | c5754a65e64126743644aec2631f165a0ac3ffe4 (patch) | |
tree | b35cb05d283e1a11cf2012f2ff4b44116725a2cd /llvm/lib/IR/DebugInfo.cpp | |
parent | 8f093f4138e1ffafb7ee5344e012ba8dd952a055 (diff) | |
download | bcm5719-llvm-c5754a65e64126743644aec2631f165a0ac3ffe4.tar.gz bcm5719-llvm-c5754a65e64126743644aec2631f165a0ac3ffe4.zip |
IR: MDNode => Value: NamedMDNode::getOperator()
Change `NamedMDNode::getOperator()` from returning `MDNode *` to
returning `Value *`. To reduce boilerplate at some call sites, add a
`getOperatorAsMDNode()` for named metadata that's expected to only
return `MDNode` -- for now, that's everything, but debug node named
metadata (such as llvm.dbg.cu and llvm.dbg.sp) will soon change. This
is part of PR21433.
Note that there's a follow-up patch to clang for the API change.
llvm-svn: 221375
Diffstat (limited to 'llvm/lib/IR/DebugInfo.cpp')
-rw-r--r-- | llvm/lib/IR/DebugInfo.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index 60904c2b356..38389e8ca1e 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -949,7 +949,7 @@ DITypeIdentifierMap llvm::generateDITypeIdentifierMap(const NamedMDNode *CU_Nodes) { DITypeIdentifierMap Map; for (unsigned CUi = 0, CUe = CU_Nodes->getNumOperands(); CUi != CUe; ++CUi) { - DICompileUnit CU(CU_Nodes->getOperand(CUi)); + DICompileUnit CU(CU_Nodes->getOperandAsMDNode(CUi)); DIArray Retain = CU.getRetainedTypes(); for (unsigned Ti = 0, Te = Retain.getNumElements(); Ti != Te; ++Ti) { if (!Retain.getElement(Ti).isCompositeType()) @@ -997,7 +997,7 @@ void DebugInfoFinder::processModule(const Module &M) { InitializeTypeMap(M); if (NamedMDNode *CU_Nodes = M.getNamedMetadata("llvm.dbg.cu")) { for (unsigned i = 0, e = CU_Nodes->getNumOperands(); i != e; ++i) { - DICompileUnit CU(CU_Nodes->getOperand(i)); + DICompileUnit CU(CU_Nodes->getOperandAsMDNode(i)); addCompileUnit(CU); DIArray GVs = CU.getGlobalVariables(); for (unsigned i = 0, e = GVs.getNumElements(); i != e; ++i) { @@ -1542,8 +1542,8 @@ llvm::makeSubprogramMap(const Module &M) { if (!CU_Nodes) return R; - for (MDNode *N : CU_Nodes->operands()) { - DICompileUnit CUNode(N); + for (Value *N : CU_Nodes->operands()) { + DICompileUnit CUNode(cast<MDNode>(N)); DIArray SPs = CUNode.getSubprograms(); for (unsigned i = 0, e = SPs.getNumElements(); i != e; ++i) { DISubprogram SP(SPs.getElement(i)); |