summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PPDirectives.cpp
diff options
context:
space:
mode:
authorCameron Desrochers <cameron@moodycamel.com>2018-01-15 19:14:16 +0000
committerCameron Desrochers <cameron@moodycamel.com>2018-01-15 19:14:16 +0000
commitb60f1b6d3debbbdbcd057d763fbef7e2492718a3 (patch)
tree33481cdd9f976cbb15d616dee5153473fd7aee87 /clang/lib/Lex/PPDirectives.cpp
parentbbe81f2d5560cb93b89ae88cf5f4b0864c50c440 (diff)
downloadbcm5719-llvm-b60f1b6d3debbbdbcd057d763fbef7e2492718a3.tar.gz
bcm5719-llvm-b60f1b6d3debbbdbcd057d763fbef7e2492718a3.zip
[PCH] Serialize skipped preprocessor ranges
The skipped preprocessor ranges are now serialized in the AST PCH file. This fixes, for example, libclang's clang_getSkippedRanges() returning zero ranges after reparsing a translation unit. Differential Revision: https://reviews.llvm.org/D20124 llvm-svn: 322503
Diffstat (limited to 'clang/lib/Lex/PPDirectives.cpp')
-rw-r--r--clang/lib/Lex/PPDirectives.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index 77ee1faf283..405d19bb285 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -558,7 +558,9 @@ void Preprocessor::SkipExcludedConditionalBlock(SourceLocation HashTokenLoc,
// the #if block.
CurPPLexer->LexingRawMode = false;
- if (Callbacks)
+ // The last skipped range isn't actually skipped yet if it's truncated
+ // by the end of the preamble; we'll resume parsing after the preamble.
+ if (Callbacks && (Tok.isNot(tok::eof) || !isRecordingPreamble()))
Callbacks->SourceRangeSkipped(
SourceRange(HashTokenLoc, CurPPLexer->getSourceLocation()),
Tok.getLocation());
OpenPOWER on IntegriCloud