mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-04 01:43:06 +00:00
IR: Move creation logic to MDNodeFwdDecl, NFC
Same as with `MDTuple`, factor out a `friend MDNode` by moving creation logic to the concrete subclass. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225690 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
45db33d634
commit
c88b471b9d
@ -813,7 +813,6 @@ MDNode *MDNode::getDistinct(LLVMContext &Context, ArrayRef<Metadata *> MDs) {
|
||||
/// uniqued, and is suitable for forward references.
|
||||
class MDNodeFwdDecl : public MDNode, ReplaceableMetadataImpl {
|
||||
friend class Metadata;
|
||||
friend class MDNode;
|
||||
friend class ReplaceableMetadataImpl;
|
||||
|
||||
MDNodeFwdDecl(LLVMContext &C, ArrayRef<Metadata *> Vals)
|
||||
@ -823,6 +822,10 @@ public:
|
||||
~MDNodeFwdDecl() { dropAllReferences(); }
|
||||
using MDNode::operator delete;
|
||||
|
||||
static MDNodeFwdDecl *get(LLVMContext &Context, ArrayRef<Metadata *> MDs) {
|
||||
return new (MDs.size()) MDNodeFwdDecl(Context, MDs);
|
||||
}
|
||||
|
||||
static bool classof(const Metadata *MD) {
|
||||
return MD->getMetadataID() == MDNodeFwdDeclKind;
|
||||
}
|
||||
|
@ -607,14 +607,10 @@ MDTuple *MDTuple::getDistinct(LLVMContext &Context, ArrayRef<Metadata *> MDs) {
|
||||
|
||||
MDNodeFwdDecl *MDNode::getTemporary(LLVMContext &Context,
|
||||
ArrayRef<Metadata *> MDs) {
|
||||
MDNodeFwdDecl *N = new (MDs.size()) MDNodeFwdDecl(Context, MDs);
|
||||
return N;
|
||||
return MDNodeFwdDecl::get(Context, MDs);
|
||||
}
|
||||
|
||||
void MDNode::deleteTemporary(MDNode *N) {
|
||||
assert(isa<MDNodeFwdDecl>(N) && "Expected forward declaration");
|
||||
delete cast<MDNodeFwdDecl>(N);
|
||||
}
|
||||
void MDNode::deleteTemporary(MDNode *N) { delete cast<MDNodeFwdDecl>(N); }
|
||||
|
||||
void UniquableMDNode::storeDistinctInContext() {
|
||||
assert(!IsDistinctInContext && "Expected newly distinct metadata");
|
||||
|
Loading…
Reference in New Issue
Block a user