diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-01-19 20:36:39 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-01-19 20:36:39 +0000 |
commit | 946fdcc50cbda9cc30bb78f6c71aa49f3c3ae7ae (patch) | |
tree | 0e036a4f09e4072d6ae5ab6faac355df0b5862b5 /llvm/lib/AsmParser/LLParser.cpp | |
parent | 0ee02fc9fea7107898390680d925238fa5cc0924 (diff) | |
download | bcm5719-llvm-946fdcc50cbda9cc30bb78f6c71aa49f3c3ae7ae.tar.gz bcm5719-llvm-946fdcc50cbda9cc30bb78f6c71aa49f3c3ae7ae.zip |
IR: Remove MDNodeFwdDecl
Remove `MDNodeFwdDecl` (as promised in r226481). Aside from API
changes, there's no real functionality change here.
`MDNode::getTemporary()` now forwards to `MDTuple::getTemporary()`,
which returns a tuple with `isTemporary()` equal to true.
The main point is that we can now add temporaries of other `MDNode`
subclasses, needed for PR22235 (I introduced `MDNodeFwdDecl` in the
first place because I didn't recognize this need, and thought they were
only needed to handle forward references).
A few things left out of (or highlighted by) this commit:
- I've had to remove the (few) uses of `std::unique_ptr<>` to deal
with temporaries, since the destructor is no longer public.
`getTemporary()` should probably return the equivalent of
`std::unique_ptr<T, MDNode::deleteTemporary>`.
- `MDLocation::getTemporary()` doesn't exist yet (worse, it actually
does exist, but does the wrong thing: `MDNode::getTemporary()` is
inherited and returns an `MDTuple`).
- `MDNode` now only has one subclass, `UniquableMDNode`, and the
distinction between them is actually somewhat confusing.
I'll fix those up next.
llvm-svn: 226501
Diffstat (limited to 'llvm/lib/AsmParser/LLParser.cpp')
-rw-r--r-- | llvm/lib/AsmParser/LLParser.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index 11a5983c8ad..ce195381cfb 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -531,7 +531,7 @@ bool LLParser::ParseMDNodeID(MDNode *&Result) { } // Otherwise, create MDNode forward reference. - MDNodeFwdDecl *FwdNode = MDNodeFwdDecl::get(Context, None); + MDTuple *FwdNode = MDTuple::getTemporary(Context, None); ForwardRefMDNodes[MID] = std::make_pair(FwdNode, Lex.getLoc()); if (NumberedMetadata.size() <= MID) @@ -597,9 +597,9 @@ bool LLParser::ParseStandaloneMetadata() { // See if this was forward referenced, if so, handle it. auto FI = ForwardRefMDNodes.find(MetadataID); if (FI != ForwardRefMDNodes.end()) { - MDNodeFwdDecl *Temp = FI->second.first; + MDTuple *Temp = FI->second.first; Temp->replaceAllUsesWith(Init); - delete Temp; + MDNode::deleteTemporary(Temp); ForwardRefMDNodes.erase(FI); assert(NumberedMetadata[MetadataID] == Init && "Tracking VH didn't work"); |