class Token;
class SourceLocation;
class TargetInfo;
+class SourceManager;
+class LangOptions;
/// NumericLiteralParser - This performs strict semantic analysis of the content
/// of a ppnumber, classifying it as either integer, floating, or erroneous,
/// If the Diagnostics pointer is non-null, then this will do semantic
/// checking of the string literal and emit errors and warnings.
static unsigned getOffsetOfStringByte(const Token &TheTok, unsigned ByteNo,
- Preprocessor &PP,
+ const SourceManager &SM,
+ const LangOptions &Features,
const TargetInfo &Target,
Diagnostic *Diags = 0);
};
/// advancing over escape sequences in the string.
unsigned StringLiteralParser::getOffsetOfStringByte(const Token &Tok,
unsigned ByteNo,
- Preprocessor &PP,
+ const SourceManager &SM,
+ const LangOptions &Features,
const TargetInfo &Target,
Diagnostic *Diags) {
// Get the spelling of the token.
- llvm::SmallString<16> SpellingBuffer;
+ llvm::SmallString<32> SpellingBuffer;
SpellingBuffer.resize(Tok.getLength());
bool StringInvalid = false;
const char *SpellingPtr = &SpellingBuffer[0];
- unsigned TokLen = Preprocessor::getSpelling(Tok, SpellingPtr,
- PP.getSourceManager(),
- PP.getLangOptions(),
+ unsigned TokLen = Preprocessor::getSpelling(Tok, SpellingPtr, SM, Features,
&StringInvalid);
if (StringInvalid)
return 0;
// Otherwise, this is an escape character. Advance over it.
bool HadError = false;
ProcessCharEscape(SpellingPtr, SpellingEnd, HadError,
- FullSourceLoc(Tok.getLocation(), PP.getSourceManager()),
+ FullSourceLoc(Tok.getLocation(), SM),
false, Diags, Target);
assert(!HadError && "This method isn't valid on erroneous strings");
--ByteNo;
if (ByteNo < TokNumBytes ||
(ByteNo == TokNumBytes && TokNo == SL->getNumConcatenated())) {
unsigned Offset =
- StringLiteralParser::getOffsetOfStringByte(TheTok, ByteNo, PP,
+ StringLiteralParser::getOffsetOfStringByte(TheTok, ByteNo,
+ PP.getSourceManager(),
+ PP.getLangOptions(),
PP.getTargetInfo());
// Now that we know the offset of the token in the spelling, use the