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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221375 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith
2014-11-05 18:16:03 +00:00
parent 4a6537c0a9
commit bad06b13ba
17 changed files with 47 additions and 42 deletions

View File

@@ -474,7 +474,7 @@ bool getSourceInfoFromDI(const Module &M, std::string &Directory,
if (!CUNode || CUNode->getNumOperands() == 0)
return false;
DICompileUnit CU(CUNode->getOperand(0));
DICompileUnit CU(cast<MDNode>(CUNode->getOperand(0)));
if (!CU.Verify())
return false;