diff options
Diffstat (limited to 'llvm/lib/CodeGen/MIRParser/MILexer.h')
-rw-r--r-- | llvm/lib/CodeGen/MIRParser/MILexer.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MIRParser/MILexer.h b/llvm/lib/CodeGen/MIRParser/MILexer.h index 2085eb38f0c..778640a2c81 100644 --- a/llvm/lib/CodeGen/MIRParser/MILexer.h +++ b/llvm/lib/CodeGen/MIRParser/MILexer.h @@ -52,6 +52,7 @@ struct MIToken { StackObject, FixedStackObject, NamedGlobalValue, + QuotedNamedGlobalValue, GlobalValue, // Other tokens @@ -94,7 +95,26 @@ public: StringRef::iterator location() const { return Range.begin(); } - StringRef stringValue() const { return Range.drop_front(StringOffset); } + bool isStringValueQuoted() const { return Kind == QuotedNamedGlobalValue; } + + /// Return the token's raw string value. + /// + /// If the string value is quoted, this method returns that quoted string as + /// it is, without unescaping the string value. + StringRef rawStringValue() const { return Range.drop_front(StringOffset); } + + /// Return token's string value. + /// + /// Expects the string value to be unquoted. + StringRef stringValue() const { + assert(!isStringValueQuoted() && "String value is quoted"); + return Range.drop_front(StringOffset); + } + + /// Unescapes the token's string value. + /// + /// Expects the string value to be quoted. + void unescapeQuotedStringValue(std::string &Str) const; const APSInt &integerValue() const { return IntVal; } |