aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/TableGen
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2011-10-19 13:02:33 +0000
committerDavid Greene <greened@obbligato.org>2011-10-19 13:02:33 +0000
commitee6dca17252de152720655282fb4b74b76fb2fe9 (patch)
tree7a639e67344437423817df6f855ccaaa157f69e8 /include/llvm/TableGen
parent96a9f78c4aa1bc188f3f7ee869bed44cb7a6ff0e (diff)
downloadexternal_llvm-ee6dca17252de152720655282fb4b74b76fb2fe9.zip
external_llvm-ee6dca17252de152720655282fb4b74b76fb2fe9.tar.gz
external_llvm-ee6dca17252de152720655282fb4b74b76fb2fe9.tar.bz2
Make VarInit Name an Init
Make the VarInit name an Init itself. We need this to implement paste functionality so we can reference variables whose names are not yet completely resolved. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142497 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/TableGen')
-rw-r--r--include/llvm/TableGen/Record.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/include/llvm/TableGen/Record.h b/include/llvm/TableGen/Record.h
index 4502aa7..47d4f7f 100644
--- a/include/llvm/TableGen/Record.h
+++ b/include/llvm/TableGen/Record.h
@@ -1058,9 +1058,11 @@ public:
/// VarInit - 'Opcode' - Represent a reference to an entire variable object.
///
class VarInit : public TypedInit {
- std::string VarName;
+ Init *VarName;
explicit VarInit(const std::string &VN, RecTy *T)
+ : TypedInit(T), VarName(StringInit::get(VN)) {}
+ explicit VarInit(Init *VN, RecTy *T)
: TypedInit(T), VarName(VN) {}
VarInit(const VarInit &Other); // Do not define.
@@ -1074,7 +1076,11 @@ public:
return Ty->convertValue(const_cast<VarInit *>(this));
}
- const std::string &getName() const { return VarName; }
+ const std::string &getName() const;
+ Init *getNameInit() const { return VarName; }
+ std::string getNameInitAsString() const {
+ return getNameInit()->getAsUnquotedString();
+ }
virtual Init *resolveBitReference(Record &R, const RecordVal *RV,
unsigned Bit) const;
@@ -1092,7 +1098,7 @@ public:
///
virtual Init *resolveReferences(Record &R, const RecordVal *RV) const;
- virtual std::string getAsString() const { return VarName; }
+ virtual std::string getAsString() const { return getName(); }
};