mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-23 14:25:07 +00:00
IR: Add missing clone() overloads
Add missing specialized node overloads for `MDNode::clone()` (they were on most of the node types already, but missing from the others). `MDNode::clone()` returns `TempMDNode` (`std::unique_ptr<MDNode,...>`), while `TempMDSubrange::clone()` (for example) returns the more convenient `TempMDSubrange` (`std::unique_ptr<TempMDSubrange,...>`). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229579 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1217,6 +1217,8 @@ public:
|
|||||||
Metadata *Type, Metadata *Value),
|
Metadata *Type, Metadata *Value),
|
||||||
(Tag, Scope, Name, Type, Value))
|
(Tag, Scope, Name, Type, Value))
|
||||||
|
|
||||||
|
TempMDTemplateValueParameter clone() const { return cloneImpl(); }
|
||||||
|
|
||||||
Metadata *getValue() const { return getOperand(3); }
|
Metadata *getValue() const { return getOperand(3); }
|
||||||
|
|
||||||
static bool classof(const Metadata *MD) {
|
static bool classof(const Metadata *MD) {
|
||||||
@@ -1310,6 +1312,8 @@ public:
|
|||||||
(Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit,
|
(Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit,
|
||||||
IsDefinition, Variable, StaticDataMemberDeclaration))
|
IsDefinition, Variable, StaticDataMemberDeclaration))
|
||||||
|
|
||||||
|
TempMDGlobalVariable clone() const { return cloneImpl(); }
|
||||||
|
|
||||||
bool isLocalToUnit() const { return IsLocalToUnit; }
|
bool isLocalToUnit() const { return IsLocalToUnit; }
|
||||||
bool isDefinition() const { return IsDefinition; }
|
bool isDefinition() const { return IsDefinition; }
|
||||||
StringRef getDisplayName() const { return getStringOperand(4); }
|
StringRef getDisplayName() const { return getStringOperand(4); }
|
||||||
@@ -1380,6 +1384,8 @@ public:
|
|||||||
Metadata *InlinedAt = nullptr),
|
Metadata *InlinedAt = nullptr),
|
||||||
(Tag, Scope, Name, File, Line, Type, Arg, Flags, InlinedAt))
|
(Tag, Scope, Name, File, Line, Type, Arg, Flags, InlinedAt))
|
||||||
|
|
||||||
|
TempMDLocalVariable clone() const { return cloneImpl(); }
|
||||||
|
|
||||||
unsigned getArg() const { return Arg; }
|
unsigned getArg() const { return Arg; }
|
||||||
unsigned getFlags() const { return Flags; }
|
unsigned getFlags() const { return Flags; }
|
||||||
Metadata *getInlinedAt() const { return getOperand(4); }
|
Metadata *getInlinedAt() const { return getOperand(4); }
|
||||||
@@ -1417,6 +1423,8 @@ class MDExpression : public DebugNode {
|
|||||||
public:
|
public:
|
||||||
DEFINE_MDNODE_GET(MDExpression, (ArrayRef<uint64_t> Elements), (Elements))
|
DEFINE_MDNODE_GET(MDExpression, (ArrayRef<uint64_t> Elements), (Elements))
|
||||||
|
|
||||||
|
TempMDExpression clone() const { return cloneImpl(); }
|
||||||
|
|
||||||
ArrayRef<uint64_t> getElements() const { return Elements; }
|
ArrayRef<uint64_t> getElements() const { return Elements; }
|
||||||
|
|
||||||
unsigned getNumElements() const { return Elements.size(); }
|
unsigned getNumElements() const { return Elements.size(); }
|
||||||
@@ -1562,6 +1570,8 @@ public:
|
|||||||
(Name, File, Line, GetterName, SetterName, Attributes,
|
(Name, File, Line, GetterName, SetterName, Attributes,
|
||||||
Type))
|
Type))
|
||||||
|
|
||||||
|
TempMDObjCProperty clone() const { return cloneImpl(); }
|
||||||
|
|
||||||
unsigned getLine() const { return Line; }
|
unsigned getLine() const { return Line; }
|
||||||
unsigned getAttributes() const { return Attributes; }
|
unsigned getAttributes() const { return Attributes; }
|
||||||
StringRef getName() const { return getStringOperand(0); }
|
StringRef getName() const { return getStringOperand(0); }
|
||||||
|
@@ -643,6 +643,9 @@ TEST_F(GenericDebugNodeTest, get) {
|
|||||||
EXPECT_EQ(Empty, N->getDwarfOperand(0));
|
EXPECT_EQ(Empty, N->getDwarfOperand(0));
|
||||||
ASSERT_TRUE(N->isUniqued());
|
ASSERT_TRUE(N->isUniqued());
|
||||||
EXPECT_EQ(N, GenericDebugNode::get(Context, 15, Header, Ops1));
|
EXPECT_EQ(N, GenericDebugNode::get(Context, 15, Header, Ops1));
|
||||||
|
|
||||||
|
TempGenericDebugNode Temp = N->clone();
|
||||||
|
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GenericDebugNodeTest, getEmptyHeader) {
|
TEST_F(GenericDebugNodeTest, getEmptyHeader) {
|
||||||
@@ -661,6 +664,9 @@ TEST_F(MDSubrangeTest, get) {
|
|||||||
EXPECT_EQ(7, N->getLo());
|
EXPECT_EQ(7, N->getLo());
|
||||||
EXPECT_EQ(N, MDSubrange::get(Context, 5, 7));
|
EXPECT_EQ(N, MDSubrange::get(Context, 5, 7));
|
||||||
EXPECT_EQ(MDSubrange::get(Context, 5, 0), MDSubrange::get(Context, 5));
|
EXPECT_EQ(MDSubrange::get(Context, 5, 0), MDSubrange::get(Context, 5));
|
||||||
|
|
||||||
|
TempMDSubrange Temp = N->clone();
|
||||||
|
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef MetadataTest MDEnumeratorTest;
|
typedef MetadataTest MDEnumeratorTest;
|
||||||
@@ -674,6 +680,9 @@ TEST_F(MDEnumeratorTest, get) {
|
|||||||
|
|
||||||
EXPECT_NE(N, MDEnumerator::get(Context, 8, "name"));
|
EXPECT_NE(N, MDEnumerator::get(Context, 8, "name"));
|
||||||
EXPECT_NE(N, MDEnumerator::get(Context, 7, "nam"));
|
EXPECT_NE(N, MDEnumerator::get(Context, 7, "nam"));
|
||||||
|
|
||||||
|
TempMDEnumerator Temp = N->clone();
|
||||||
|
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef MetadataTest MDBasicTypeTest;
|
typedef MetadataTest MDBasicTypeTest;
|
||||||
@@ -700,6 +709,9 @@ TEST_F(MDBasicTypeTest, get) {
|
|||||||
25, 7));
|
25, 7));
|
||||||
EXPECT_NE(N, MDBasicType::get(Context, dwarf::DW_TAG_base_type, "special", 33,
|
EXPECT_NE(N, MDBasicType::get(Context, dwarf::DW_TAG_base_type, "special", 33,
|
||||||
26, 6));
|
26, 6));
|
||||||
|
|
||||||
|
TempMDBasicType Temp = N->clone();
|
||||||
|
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef MetadataTest MDDerivedTypeTest;
|
typedef MetadataTest MDDerivedTypeTest;
|
||||||
@@ -760,6 +772,9 @@ TEST_F(MDDerivedTypeTest, get) {
|
|||||||
EXPECT_NE(N,
|
EXPECT_NE(N,
|
||||||
MDDerivedType::get(Context, dwarf::DW_TAG_pointer_type, "something",
|
MDDerivedType::get(Context, dwarf::DW_TAG_pointer_type, "something",
|
||||||
File, 1, Scope, BaseType, 2, 3, 4, 5, File));
|
File, 1, Scope, BaseType, 2, 3, 4, 5, File));
|
||||||
|
|
||||||
|
TempMDDerivedType Temp = N->clone();
|
||||||
|
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef MetadataTest MDCompositeTypeTest;
|
typedef MetadataTest MDCompositeTypeTest;
|
||||||
@@ -876,6 +891,9 @@ TEST_F(MDCompositeTypeTest, get) {
|
|||||||
Context, Tag, Name, File, Line, Scope, BaseType, SizeInBits,
|
Context, Tag, Name, File, Line, Scope, BaseType, SizeInBits,
|
||||||
AlignInBits, OffsetInBits, Flags, Elements, RuntimeLang,
|
AlignInBits, OffsetInBits, Flags, Elements, RuntimeLang,
|
||||||
VTableHolder, TemplateParams)->getRawIdentifier());
|
VTableHolder, TemplateParams)->getRawIdentifier());
|
||||||
|
|
||||||
|
TempMDCompositeType Temp = N->clone();
|
||||||
|
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef MetadataTest MDSubroutineTypeTest;
|
typedef MetadataTest MDSubroutineTypeTest;
|
||||||
@@ -893,6 +911,9 @@ TEST_F(MDSubroutineTypeTest, get) {
|
|||||||
EXPECT_NE(N, MDSubroutineType::get(Context, Flags + 1, TypeArray));
|
EXPECT_NE(N, MDSubroutineType::get(Context, Flags + 1, TypeArray));
|
||||||
EXPECT_NE(N, MDSubroutineType::get(Context, Flags,
|
EXPECT_NE(N, MDSubroutineType::get(Context, Flags,
|
||||||
MDTuple::getDistinct(Context, None)));
|
MDTuple::getDistinct(Context, None)));
|
||||||
|
|
||||||
|
TempMDSubroutineType Temp = N->clone();
|
||||||
|
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef MetadataTest MDFileTest;
|
typedef MetadataTest MDFileTest;
|
||||||
@@ -909,6 +930,9 @@ TEST_F(MDFileTest, get) {
|
|||||||
|
|
||||||
EXPECT_NE(N, MDFile::get(Context, "other", Directory));
|
EXPECT_NE(N, MDFile::get(Context, "other", Directory));
|
||||||
EXPECT_NE(N, MDFile::get(Context, Filename, "other"));
|
EXPECT_NE(N, MDFile::get(Context, Filename, "other"));
|
||||||
|
|
||||||
|
TempMDFile Temp = N->clone();
|
||||||
|
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef MetadataTest MDCompileUnitTest;
|
typedef MetadataTest MDCompileUnitTest;
|
||||||
@@ -1013,6 +1037,9 @@ TEST_F(MDCompileUnitTest, get) {
|
|||||||
Context, SourceLanguage, File, Producer, IsOptimized, Flags,
|
Context, SourceLanguage, File, Producer, IsOptimized, Flags,
|
||||||
RuntimeVersion, SplitDebugFilename, EmissionKind, EnumTypes,
|
RuntimeVersion, SplitDebugFilename, EmissionKind, EnumTypes,
|
||||||
RetainedTypes, Subprograms, GlobalVariables, File));
|
RetainedTypes, Subprograms, GlobalVariables, File));
|
||||||
|
|
||||||
|
TempMDCompileUnit Temp = N->clone();
|
||||||
|
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef MetadataTest MDSubprogramTest;
|
typedef MetadataTest MDSubprogramTest;
|
||||||
@@ -1157,6 +1184,9 @@ TEST_F(MDSubprogramTest, get) {
|
|||||||
ContainingType, Virtuality, VirtualIndex,
|
ContainingType, Virtuality, VirtualIndex,
|
||||||
Flags, IsOptimized, Function, TemplateParams,
|
Flags, IsOptimized, Function, TemplateParams,
|
||||||
Declaration, Type));
|
Declaration, Type));
|
||||||
|
|
||||||
|
TempMDSubprogram Temp = N->clone();
|
||||||
|
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef MetadataTest MDLexicalBlockTest;
|
typedef MetadataTest MDLexicalBlockTest;
|
||||||
@@ -1180,6 +1210,9 @@ TEST_F(MDLexicalBlockTest, get) {
|
|||||||
EXPECT_NE(N, MDLexicalBlock::get(Context, Scope, Scope, Line, Column));
|
EXPECT_NE(N, MDLexicalBlock::get(Context, Scope, Scope, Line, Column));
|
||||||
EXPECT_NE(N, MDLexicalBlock::get(Context, Scope, File, Line + 1, Column));
|
EXPECT_NE(N, MDLexicalBlock::get(Context, Scope, File, Line + 1, Column));
|
||||||
EXPECT_NE(N, MDLexicalBlock::get(Context, Scope, File, Line, Column + 1));
|
EXPECT_NE(N, MDLexicalBlock::get(Context, Scope, File, Line, Column + 1));
|
||||||
|
|
||||||
|
TempMDLexicalBlock Temp = N->clone();
|
||||||
|
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef MetadataTest MDLexicalBlockFileTest;
|
typedef MetadataTest MDLexicalBlockFileTest;
|
||||||
@@ -1201,6 +1234,9 @@ TEST_F(MDLexicalBlockFileTest, get) {
|
|||||||
EXPECT_NE(N, MDLexicalBlockFile::get(Context, Scope, Scope, Discriminator));
|
EXPECT_NE(N, MDLexicalBlockFile::get(Context, Scope, Scope, Discriminator));
|
||||||
EXPECT_NE(N,
|
EXPECT_NE(N,
|
||||||
MDLexicalBlockFile::get(Context, Scope, File, Discriminator + 1));
|
MDLexicalBlockFile::get(Context, Scope, File, Discriminator + 1));
|
||||||
|
|
||||||
|
TempMDLexicalBlockFile Temp = N->clone();
|
||||||
|
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef MetadataTest MDNamespaceTest;
|
typedef MetadataTest MDNamespaceTest;
|
||||||
@@ -1224,6 +1260,9 @@ TEST_F(MDNamespaceTest, get) {
|
|||||||
EXPECT_NE(N, MDNamespace::get(Context, Scope, Scope, Name, Line));
|
EXPECT_NE(N, MDNamespace::get(Context, Scope, Scope, Name, Line));
|
||||||
EXPECT_NE(N, MDNamespace::get(Context, Scope, File, "other", Line));
|
EXPECT_NE(N, MDNamespace::get(Context, Scope, File, "other", Line));
|
||||||
EXPECT_NE(N, MDNamespace::get(Context, Scope, File, Name, Line + 1));
|
EXPECT_NE(N, MDNamespace::get(Context, Scope, File, Name, Line + 1));
|
||||||
|
|
||||||
|
TempMDNamespace Temp = N->clone();
|
||||||
|
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef MetadataTest MDTemplateTypeParameterTest;
|
typedef MetadataTest MDTemplateTypeParameterTest;
|
||||||
@@ -1244,6 +1283,9 @@ TEST_F(MDTemplateTypeParameterTest, get) {
|
|||||||
EXPECT_NE(N, MDTemplateTypeParameter::get(Context, Type, Name, Type));
|
EXPECT_NE(N, MDTemplateTypeParameter::get(Context, Type, Name, Type));
|
||||||
EXPECT_NE(N, MDTemplateTypeParameter::get(Context, Scope, "other", Type));
|
EXPECT_NE(N, MDTemplateTypeParameter::get(Context, Scope, "other", Type));
|
||||||
EXPECT_NE(N, MDTemplateTypeParameter::get(Context, Scope, Name, Scope));
|
EXPECT_NE(N, MDTemplateTypeParameter::get(Context, Scope, Name, Scope));
|
||||||
|
|
||||||
|
TempMDTemplateTypeParameter Temp = N->clone();
|
||||||
|
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef MetadataTest MDTemplateValueParameterTest;
|
typedef MetadataTest MDTemplateValueParameterTest;
|
||||||
@@ -1276,6 +1318,9 @@ TEST_F(MDTemplateValueParameterTest, get) {
|
|||||||
Value));
|
Value));
|
||||||
EXPECT_NE(
|
EXPECT_NE(
|
||||||
N, MDTemplateValueParameter::get(Context, Tag, Scope, Name, Type, Scope));
|
N, MDTemplateValueParameter::get(Context, Tag, Scope, Name, Type, Scope));
|
||||||
|
|
||||||
|
TempMDTemplateValueParameter Temp = N->clone();
|
||||||
|
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef MetadataTest MDGlobalVariableTest;
|
typedef MetadataTest MDGlobalVariableTest;
|
||||||
@@ -1341,6 +1386,9 @@ TEST_F(MDGlobalVariableTest, get) {
|
|||||||
EXPECT_NE(N, MDGlobalVariable::get(Context, Scope, Name, LinkageName, File,
|
EXPECT_NE(N, MDGlobalVariable::get(Context, Scope, Name, LinkageName, File,
|
||||||
Line, Type, IsLocalToUnit, IsDefinition,
|
Line, Type, IsLocalToUnit, IsDefinition,
|
||||||
Variable, Type));
|
Variable, Type));
|
||||||
|
|
||||||
|
TempMDGlobalVariable Temp = N->clone();
|
||||||
|
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef MetadataTest MDLocalVariableTest;
|
typedef MetadataTest MDLocalVariableTest;
|
||||||
@@ -1389,6 +1437,9 @@ TEST_F(MDLocalVariableTest, get) {
|
|||||||
Arg, ~Flags, InlinedAt));
|
Arg, ~Flags, InlinedAt));
|
||||||
EXPECT_NE(N, MDLocalVariable::get(Context, Tag, Scope, Name, File, Line, Type,
|
EXPECT_NE(N, MDLocalVariable::get(Context, Tag, Scope, Name, File, Line, Type,
|
||||||
Arg, Flags, Scope));
|
Arg, Flags, Scope));
|
||||||
|
|
||||||
|
TempMDLocalVariable Temp = N->clone();
|
||||||
|
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef MetadataTest MDExpressionTest;
|
typedef MetadataTest MDExpressionTest;
|
||||||
@@ -1405,6 +1456,9 @@ TEST_F(MDExpressionTest, get) {
|
|||||||
EXPECT_EQ(9u, N->getElement(2));
|
EXPECT_EQ(9u, N->getElement(2));
|
||||||
EXPECT_EQ(78u, N->getElement(3));
|
EXPECT_EQ(78u, N->getElement(3));
|
||||||
EXPECT_EQ(0u, N->getElement(4));
|
EXPECT_EQ(0u, N->getElement(4));
|
||||||
|
|
||||||
|
TempMDExpression Temp = N->clone();
|
||||||
|
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MDExpressionTest, isValid) {
|
TEST_F(MDExpressionTest, isValid) {
|
||||||
@@ -1482,6 +1536,9 @@ TEST_F(MDObjCPropertyTest, get) {
|
|||||||
SetterName, Attributes + 1, Type));
|
SetterName, Attributes + 1, Type));
|
||||||
EXPECT_NE(N, MDObjCProperty::get(Context, Name, File, Line, GetterName,
|
EXPECT_NE(N, MDObjCProperty::get(Context, Name, File, Line, GetterName,
|
||||||
SetterName, Attributes, File));
|
SetterName, Attributes, File));
|
||||||
|
|
||||||
|
TempMDObjCProperty Temp = N->clone();
|
||||||
|
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef MetadataTest MDImportedEntityTest;
|
typedef MetadataTest MDImportedEntityTest;
|
||||||
@@ -1511,6 +1568,9 @@ TEST_F(MDImportedEntityTest, get) {
|
|||||||
MDImportedEntity::get(Context, Tag, Scope, Entity, Line + 1, Name));
|
MDImportedEntity::get(Context, Tag, Scope, Entity, Line + 1, Name));
|
||||||
EXPECT_NE(N,
|
EXPECT_NE(N,
|
||||||
MDImportedEntity::get(Context, Tag, Scope, Entity, Line, "other"));
|
MDImportedEntity::get(Context, Tag, Scope, Entity, Line, "other"));
|
||||||
|
|
||||||
|
TempMDImportedEntity Temp = N->clone();
|
||||||
|
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef MetadataTest MetadataAsValueTest;
|
typedef MetadataTest MetadataAsValueTest;
|
||||||
|
Reference in New Issue
Block a user