diff options
| author | Chris Lattner <sabre@nondot.org> | 2006-07-02 23:00:20 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2006-07-02 23:00:20 +0000 |
| commit | 98a53124783a9b9b559b071628065659b9883783 (patch) | |
| tree | f434909e10aba4a18c7cfa11f69d78f8d6152296 /clang/Lex/Pragma.cpp | |
| parent | e55e11ad040e559a4f281545563f12387303d685 (diff) | |
| download | bcm5719-llvm-98a53124783a9b9b559b071628065659b9883783.tar.gz bcm5719-llvm-98a53124783a9b9b559b071628065659b9883783.zip | |
Give tokens expanded from _Pragma directives correct source locations.
This implements test/Preprocessor/_Pragma-location.c
llvm-svn: 38619
Diffstat (limited to 'clang/Lex/Pragma.cpp')
| -rw-r--r-- | clang/Lex/Pragma.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/Lex/Pragma.cpp b/clang/Lex/Pragma.cpp index 2cdbb72cf79..5aa1b23652e 100644 --- a/clang/Lex/Pragma.cpp +++ b/clang/Lex/Pragma.cpp @@ -114,11 +114,10 @@ void Preprocessor::Handle_Pragma(LexerToken &Tok) { // Plop the string (including the trailing null) into a buffer where we can // lex it. - SourceLocation TokLoc = ScratchBuf->getToken(&StrVal[0], StrVal.size()); + SourceLocation TokLoc = ScratchBuf->getToken(&StrVal[0], StrVal.size(), + PragmaLoc); const char *StrData = SourceMgr.getCharacterData(TokLoc); - // FIXME: Create appropriate mapping info for this FileID, so that we know the - // tokens are coming out of the input string (StrLoc). unsigned FileID = TokLoc.getFileID(); assert(FileID && "Could not create FileID for predefines?"); @@ -126,7 +125,6 @@ void Preprocessor::Handle_Pragma(LexerToken &Tok) { // like any others. Lexer *TL = new Lexer(SourceMgr.getBuffer(FileID), FileID, *this, StrData, StrData+StrVal.size()-1 /* no null */); - EnterSourceFileWithLexer(TL, 0); // Ensure that the lexer thinks it is inside a directive, so that end \n will // return an EOM token. @@ -134,7 +132,9 @@ void Preprocessor::Handle_Pragma(LexerToken &Tok) { // This lexer really is for _Pragma. TL->Is_PragmaLexer = true; - + + EnterSourceFileWithLexer(TL, 0); + // With everything set up, lex this as a #pragma directive. HandlePragmaDirective(); |

