mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-02 22:23:10 +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:
@@ -813,7 +813,6 @@ MDNode *MDNode::getDistinct(LLVMContext &Context, ArrayRef<Metadata *> MDs) {
|
|||||||
/// uniqued, and is suitable for forward references.
|
/// uniqued, and is suitable for forward references.
|
||||||
class MDNodeFwdDecl : public MDNode, ReplaceableMetadataImpl {
|
class MDNodeFwdDecl : public MDNode, ReplaceableMetadataImpl {
|
||||||
friend class Metadata;
|
friend class Metadata;
|
||||||
friend class MDNode;
|
|
||||||
friend class ReplaceableMetadataImpl;
|
friend class ReplaceableMetadataImpl;
|
||||||
|
|
||||||
MDNodeFwdDecl(LLVMContext &C, ArrayRef<Metadata *> Vals)
|
MDNodeFwdDecl(LLVMContext &C, ArrayRef<Metadata *> Vals)
|
||||||
@@ -823,6 +822,10 @@ public:
|
|||||||
~MDNodeFwdDecl() { dropAllReferences(); }
|
~MDNodeFwdDecl() { dropAllReferences(); }
|
||||||
using MDNode::operator delete;
|
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) {
|
static bool classof(const Metadata *MD) {
|
||||||
return MD->getMetadataID() == MDNodeFwdDeclKind;
|
return MD->getMetadataID() == MDNodeFwdDeclKind;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -607,14 +607,10 @@ MDTuple *MDTuple::getDistinct(LLVMContext &Context, ArrayRef<Metadata *> MDs) {
|
|||||||
|
|
||||||
MDNodeFwdDecl *MDNode::getTemporary(LLVMContext &Context,
|
MDNodeFwdDecl *MDNode::getTemporary(LLVMContext &Context,
|
||||||
ArrayRef<Metadata *> MDs) {
|
ArrayRef<Metadata *> MDs) {
|
||||||
MDNodeFwdDecl *N = new (MDs.size()) MDNodeFwdDecl(Context, MDs);
|
return MDNodeFwdDecl::get(Context, MDs);
|
||||||
return N;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MDNode::deleteTemporary(MDNode *N) {
|
void MDNode::deleteTemporary(MDNode *N) { delete cast<MDNodeFwdDecl>(N); }
|
||||||
assert(isa<MDNodeFwdDecl>(N) && "Expected forward declaration");
|
|
||||||
delete cast<MDNodeFwdDecl>(N);
|
|
||||||
}
|
|
||||||
|
|
||||||
void UniquableMDNode::storeDistinctInContext() {
|
void UniquableMDNode::storeDistinctInContext() {
|
||||||
assert(!IsDistinctInContext && "Expected newly distinct metadata");
|
assert(!IsDistinctInContext && "Expected newly distinct metadata");
|
||||||
|
|||||||
Reference in New Issue
Block a user