equal,
underscore,
colon,
+ exclaim,
+ lparen,
+ rparen,
// Keywords
kw_implicit,
kw_dead,
kw_killed,
kw_undef,
+ kw_frame_setup,
+ kw_debug_location,
+ kw_cfi_offset,
+ kw_cfi_def_cfa_register,
+ kw_cfi_def_cfa_offset,
+ kw_cfi_def_cfa,
+ kw_blockaddress,
+ kw_target_index,
// Identifier tokens
Identifier,
NamedRegister,
MachineBasicBlock,
+ StackObject,
+ FixedStackObject,
NamedGlobalValue,
+ QuotedNamedGlobalValue,
GlobalValue,
+ ExternalSymbol,
+ QuotedExternalSymbol,
// Other tokens
IntegerLiteral,
VirtualRegister,
- JumpTableIndex
+ ConstantPoolItem,
+ JumpTableIndex,
+ NamedIRBlock,
+ QuotedNamedIRBlock,
+ IRBlock,
};
private:
StringRef::iterator location() const { return Range.begin(); }
- StringRef stringValue() const { return Range.drop_front(StringOffset); }
+ bool isStringValueQuoted() const {
+ return Kind == QuotedNamedGlobalValue || Kind == QuotedExternalSymbol ||
+ Kind == QuotedNamedIRBlock;
+ }
+
+ /// 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; }
bool hasIntegerValue() const {
return Kind == IntegerLiteral || Kind == MachineBasicBlock ||
+ Kind == StackObject || Kind == FixedStackObject ||
Kind == GlobalValue || Kind == VirtualRegister ||
- Kind == JumpTableIndex;
+ Kind == ConstantPoolItem || Kind == JumpTableIndex ||
+ Kind == IRBlock;
}
};