forked from OSchip/llvm-project
Give tokens from the scratch buffer correct source locations.
llvm-svn: 38591
This commit is contained in:
parent
dc9f9bf80e
commit
4fb517bea8
|
@ -531,6 +531,7 @@ void Preprocessor::ExpandBuiltinMacro(LexerToken &Tok, MacroInfo *MI) {
|
|||
Tok.SetKind(tok::numeric_constant);
|
||||
Tok.SetLength(Length);
|
||||
Tok.SetLocation(ScratchBuf->getToken(TmpBuffer, Length, Tok.getLocation()));
|
||||
Tok.SetIdentifierInfo(0);
|
||||
Tok.ClearFlag(LexerToken::NeedsCleaning);
|
||||
return;
|
||||
} else {
|
||||
|
|
|
@ -39,13 +39,14 @@ SourceLocation ScratchBuffer::getToken(const char *Buf, unsigned Len,
|
|||
// Copy the token data into the buffer.
|
||||
memcpy(CurBuffer+BytesUsed, Buf, Len);
|
||||
|
||||
unsigned InstantiationFileID =
|
||||
SourceMgr.createFileIDForMacroExp(SourceLoc, FileID);
|
||||
|
||||
// Create the initial SourceLocation.
|
||||
SourceLocation Loc(FileID, BytesUsed);
|
||||
SourceLocation Loc(InstantiationFileID, BytesUsed);
|
||||
assert(BytesUsed < (1 << SourceLocation::FilePosBits) &&
|
||||
"Out of range file position!");
|
||||
|
||||
// FIXME: Merge SourceLoc into it.
|
||||
|
||||
// Remember that we used these bytes.
|
||||
BytesUsed += Len;
|
||||
|
||||
|
|
Loading…
Reference in New Issue