summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-05-22 22:10:16 +0000
committerChris Lattner <sabre@nondot.org>2011-05-22 22:10:16 +0000
commit3bdc7679ce7bf7c6a62b37ec431f3490df732c90 (patch)
tree5b839e6d4ff179ff962619d3c700c217494689da /clang/lib/Lex
parenta8cde3c08d5bb60b1e9946d0964412828e35de2f (diff)
downloadbcm5719-llvm-3bdc7679ce7bf7c6a62b37ec431f3490df732c90.tar.gz
bcm5719-llvm-3bdc7679ce7bf7c6a62b37ec431f3490df732c90.zip
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. llvm-svn: 131871
Diffstat (limited to 'clang/lib/Lex')
-rw-r--r--clang/lib/Lex/Pragma.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/Lex/Pragma.cpp b/clang/lib/Lex/Pragma.cpp
index 0c180918dc2..a1c4498a94d 100644
--- a/clang/lib/Lex/Pragma.cpp
+++ b/clang/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.
OpenPOWER on IntegriCloud