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:
Duncan P. N. Exon Smith
2015-02-17 23:10:13 +00:00
parent 4bf44517c8
commit 15aa8bae80
2 changed files with 70 additions and 0 deletions

View File

@@ -1217,6 +1217,8 @@ public:
Metadata *Type, Metadata *Value),
(Tag, Scope, Name, Type, Value))
TempMDTemplateValueParameter clone() const { return cloneImpl(); }
Metadata *getValue() const { return getOperand(3); }
static bool classof(const Metadata *MD) {
@@ -1310,6 +1312,8 @@ public:
(Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit,
IsDefinition, Variable, StaticDataMemberDeclaration))
TempMDGlobalVariable clone() const { return cloneImpl(); }
bool isLocalToUnit() const { return IsLocalToUnit; }
bool isDefinition() const { return IsDefinition; }
StringRef getDisplayName() const { return getStringOperand(4); }
@@ -1380,6 +1384,8 @@ public:
Metadata *InlinedAt = nullptr),
(Tag, Scope, Name, File, Line, Type, Arg, Flags, InlinedAt))
TempMDLocalVariable clone() const { return cloneImpl(); }
unsigned getArg() const { return Arg; }
unsigned getFlags() const { return Flags; }
Metadata *getInlinedAt() const { return getOperand(4); }
@@ -1417,6 +1423,8 @@ class MDExpression : public DebugNode {
public:
DEFINE_MDNODE_GET(MDExpression, (ArrayRef<uint64_t> Elements), (Elements))
TempMDExpression clone() const { return cloneImpl(); }
ArrayRef<uint64_t> getElements() const { return Elements; }
unsigned getNumElements() const { return Elements.size(); }
@@ -1562,6 +1570,8 @@ public:
(Name, File, Line, GetterName, SetterName, Attributes,
Type))
TempMDObjCProperty clone() const { return cloneImpl(); }
unsigned getLine() const { return Line; }
unsigned getAttributes() const { return Attributes; }
StringRef getName() const { return getStringOperand(0); }