[cfe-commits] r38591 - in /cfe/cfe/trunk/Lex: Preprocessor.cpp ScratchBuffer.cpp
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:23:00 PDT 2007
Author: sabre
Date: Wed Jul 11 11:23:00 2007
New Revision: 38591
URL: http://llvm.org/viewvc/llvm-project?rev=38591&view=rev
Log:
Give tokens from the scratch buffer correct source locations.
Modified:
cfe/cfe/trunk/Lex/Preprocessor.cpp
cfe/cfe/trunk/Lex/ScratchBuffer.cpp
Modified: cfe/cfe/trunk/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Lex/Preprocessor.cpp?rev=38591&r1=38590&r2=38591&view=diff
==============================================================================
--- cfe/cfe/trunk/Lex/Preprocessor.cpp (original)
+++ cfe/cfe/trunk/Lex/Preprocessor.cpp Wed Jul 11 11:23:00 2007
@@ -531,6 +531,7 @@
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 {
Modified: cfe/cfe/trunk/Lex/ScratchBuffer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Lex/ScratchBuffer.cpp?rev=38591&r1=38590&r2=38591&view=diff
==============================================================================
--- cfe/cfe/trunk/Lex/ScratchBuffer.cpp (original)
+++ cfe/cfe/trunk/Lex/ScratchBuffer.cpp Wed Jul 11 11:23:00 2007
@@ -39,13 +39,14 @@
// 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;
More information about the cfe-commits
mailing list