diff options
author | Chris Lattner <sabre@nondot.org> | 2011-05-22 22:10:16 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-05-22 22:10:16 +0000 |
commit | 784c257c8f5c3a737b0ae1dceb5d54d29b6637cf (patch) | |
tree | 716dc9bf3d8d440f00dd9beb73865e1a3fbda86a /lib/Lex/Pragma.cpp | |
parent | b644425e4c337f5fcffc00b2d4914d3e4012c45a (diff) |
Invoke the FileChanged callback before pushing the linemarker for a system
header. Getting it in the wrong order generated incorrect line markers in -E
mode. In the testcase from PR9861 we used to generate:
# 1 "test.c" 2
# 1 "./foobar.h" 1
# 0 "./foobar.h"
# 0 "./foobar.h" 3
# 2 "test.c" 2
now we properly produce:
# 1 "test.c" 2
# 1 "./foobar.h" 1
# 1 "./foobar.h" 3
# 2 "test.c" 2
This fixes PR9861.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131871 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Pragma.cpp')
-rw-r--r-- | lib/Lex/Pragma.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Lex/Pragma.cpp b/lib/Lex/Pragma.cpp index 0c180918dc..a1c4498a94 100644 --- a/lib/Lex/Pragma.cpp +++ b/lib/Lex/Pragma.cpp @@ -330,16 +330,16 @@ void Preprocessor::HandlePragmaSystemHeader(Token &SysHeaderTok) { unsigned FilenameID = SourceMgr.getLineTableFilenameID(PLoc.getFilename(), FilenameLen); + // Notify the client, if desired, that we are in a new source file. + if (Callbacks) + Callbacks->FileChanged(SysHeaderTok.getLocation(), + PPCallbacks::SystemHeaderPragma, SrcMgr::C_System); + // Emit a line marker. This will change any source locations from this point // forward to realize they are in a system header. // Create a line note with this information. SourceMgr.AddLineNote(SysHeaderTok.getLocation(), PLoc.getLine(), FilenameID, false, false, true, false); - - // Notify the client, if desired, that we are in a new source file. - if (Callbacks) - Callbacks->FileChanged(SysHeaderTok.getLocation(), - PPCallbacks::SystemHeaderPragma, SrcMgr::C_System); } /// HandlePragmaDependency - Handle #pragma GCC dependency "foo" blah. |