OSDN Git Service

Add getAsUnquotedString
authorDavid Greene <greened@obbligato.org>
Wed, 10 Aug 2011 18:27:45 +0000 (18:27 +0000)
committerDavid Greene <greened@obbligato.org>
Wed, 10 Aug 2011 18:27:45 +0000 (18:27 +0000)
Add a method to return an Init as an unquoted string.  This primarily
affects StringInit where we return the value without surrounding it
with quotes.

This is in preparation for removing the ugly #NAME# hack and replacing
it with standard TabelGen operators.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137231 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/Record.h

index a8ab800..802eaed 100644 (file)
@@ -506,6 +506,11 @@ public:
 
   /// getAsString - Convert this value to a string form.
   virtual std::string getAsString() const = 0;
+  /// getAsUnquotedString - Convert this value to a string form,
+  /// without adding quote markers.  This primaruly affects
+  /// StringInits where we will not surround the string value with
+  /// quotes.
+  virtual std::string getAsUnquotedString() const { return getAsString(); }  
 
   /// dump - Debugging method that may be called through a debugger, just
   /// invokes print on stderr.
@@ -757,6 +762,7 @@ public:
   }
 
   virtual std::string getAsString() const { return "\"" + Value + "\""; }
+  virtual std::string getAsUnquotedString() const { return Value; }
 
   /// resolveBitReference - This method is used to implement
   /// VarBitInit::resolveReferences.  If the bit is able to be resolved, we