[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
Showing
- include/clang/Lex/PPCallbacks.h 7 additions, 4 deletionsinclude/clang/Lex/PPCallbacks.h
- include/clang/Lex/PreprocessingRecord.h 2 additions, 1 deletioninclude/clang/Lex/PreprocessingRecord.h
- include/clang/Lex/Preprocessor.h 8 additions, 6 deletionsinclude/clang/Lex/Preprocessor.h
- lib/CodeGen/CoverageMappingGen.cpp 1 addition, 1 deletionlib/CodeGen/CoverageMappingGen.cpp
- lib/CodeGen/CoverageMappingGen.h 1 addition, 1 deletionlib/CodeGen/CoverageMappingGen.h
- lib/Lex/PPDirectives.cpp 34 additions, 25 deletionslib/Lex/PPDirectives.cpp
- lib/Lex/PreprocessingRecord.cpp 3 additions, 2 deletionslib/Lex/PreprocessingRecord.cpp
- test/CoverageMapping/preprocessor.c 43 additions, 10 deletionstest/CoverageMapping/preprocessor.c
- test/Index/skipped-ranges.c 3 additions, 3 deletionstest/Index/skipped-ranges.c
- tools/libclang/Indexing.cpp 2 additions, 1 deletiontools/libclang/Indexing.cpp
Loading
Please register or sign in to comment