]> granicus.if.org Git - clang/commit
[Lexer] Report more precise skipped regions (PR34166)
authorVedant Kumar <vsk@apple.com>
Mon, 11 Sep 2017 20:47:42 +0000 (20:47 +0000)
committerVedant Kumar <vsk@apple.com>
Mon, 11 Sep 2017 20:47:42 +0000 (20:47 +0000)
commitc9445f041caab06d4aa184cb0e0b15a5d27feeaf
treeaacf72d3c2454e77902847fc6c70509311e9047b
parent440d6c02ac5cfe1d6f777a2d0f61686783c108f1
[Lexer] Report more precise skipped regions (PR34166)

This patch teaches the preprocessor to report more precise source ranges for
code that is skipped due to conditional directives.

The new behavior includes the '#' from the opening directive and the full text
of the line containing the closing directive in the skipped area. This matches
up clang's behavior (we don't IRGen the code between the closing "endif" and
the end of a line).

This also affects the code coverage implementation. See llvm.org/PR34166 (this
also happens to be rdar://problem/23224058).

The old behavior (report the end of the skipped range as the end
location of the 'endif' token) is preserved for indexing clients.

Differential Revision: https://reviews.llvm.org/D36642

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312947 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Lex/PPCallbacks.h
include/clang/Lex/PreprocessingRecord.h
include/clang/Lex/Preprocessor.h
lib/CodeGen/CoverageMappingGen.cpp
lib/CodeGen/CoverageMappingGen.h
lib/Lex/PPDirectives.cpp
lib/Lex/PreprocessingRecord.cpp
test/CoverageMapping/preprocessor.c
test/Index/skipped-ranges.c
tools/libclang/Indexing.cpp