From 4fa23625abb476ac89b84d06ee2a45ef822eaf15 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 26 Jan 2009 00:43:02 +0000 Subject: Check in the long promised SourceLocation rewrite. This lays the ground work for implementing #line, and fixes the "out of macro ID's" problem. There is nothing particularly tricky about the code, other than the very performance sensitive SourceManager::getFileID() method. llvm-svn: 62978 --- clang/lib/Lex/TokenLexer.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'clang/lib/Lex/TokenLexer.cpp') diff --git a/clang/lib/Lex/TokenLexer.cpp b/clang/lib/Lex/TokenLexer.cpp index dd5352c1b61..ea4ce669d1d 100644 --- a/clang/lib/Lex/TokenLexer.cpp +++ b/clang/lib/Lex/TokenLexer.cpp @@ -314,8 +314,9 @@ void TokenLexer::Lex(Token &Tok) { // that captures all of this. if (InstantiateLoc.isValid()) { // Don't do this for token streams. SourceManager &SrcMgr = PP.getSourceManager(); - Tok.setLocation(SrcMgr.getInstantiationLoc(Tok.getLocation(), - InstantiateLoc)); + Tok.setLocation(SrcMgr.createInstantiationLoc(Tok.getLocation(), + InstantiateLoc, + Tok.getLength())); } // If this is the first token, set the lexical properties of the token to @@ -398,7 +399,7 @@ bool TokenLexer::PasteTokens(Token &Tok) { "Should be a raw location into scratch buffer"); SourceManager &SourceMgr = PP.getSourceManager(); std::pair LocInfo = - SourceMgr.getDecomposedFileLoc(ResultTokLoc); + SourceMgr.getDecomposedLoc(ResultTokLoc); const char *ScratchBufStart =SourceMgr.getBufferData(LocInfo.first).first; -- cgit v1.2.3