diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Lex/LiteralSupport.cpp | 11 | ||||
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 4 |
2 files changed, 8 insertions, 7 deletions
diff --git a/lib/Lex/LiteralSupport.cpp b/lib/Lex/LiteralSupport.cpp index 26be1d0ae1..0739c88d20 100644 --- a/lib/Lex/LiteralSupport.cpp +++ b/lib/Lex/LiteralSupport.cpp @@ -1007,18 +1007,17 @@ StringLiteralParser(const Token *StringToks, unsigned NumStringToks, /// 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; @@ -1047,7 +1046,7 @@ unsigned StringLiteralParser::getOffsetOfStringByte(const Token &Tok, // 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; diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index c33eba9fab..278d820320 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -90,7 +90,9 @@ SourceLocation Sema::getLocationOfStringLiteralByte(const StringLiteral *SL, 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 |