]> granicus.if.org Git - clang/commit
[clang-scan-deps] add skip excluded conditional preprocessor block preprocessing...
authorAlex Lorenz <arphaman@gmail.com>
Wed, 11 Sep 2019 20:40:31 +0000 (20:40 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Wed, 11 Sep 2019 20:40:31 +0000 (20:40 +0000)
commit2f84230495c48ff3c1374151ce35a6c0a54ad01e
treebe335ae9f499dbbe2db0326747589630ee7c70de
parentf5d449a52774ee2e43614ab6cffd5408247a598b
[clang-scan-deps] add skip excluded conditional preprocessor block preprocessing optimization

This commit adds an optimization to clang-scan-deps and clang's preprocessor that skips excluded preprocessor
blocks by bumping the lexer pointer, and not lexing the tokens until reaching appropriate #else/#endif directive.
The skip positions and lexer offsets are computed when the file is minimized, directly from the minimized tokens.

On an 18-core iMacPro with macOS Catalina Beta I got 10-15% speed-up from this optimization when running clang-scan-deps on
the compilation database for a recent LLVM and Clang (3511 files).

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371656 91177308-0d34-0410-b5e6-96231b3b80d8
18 files changed:
include/clang/Lex/DependencyDirectivesSourceMinimizer.h
include/clang/Lex/Lexer.h
include/clang/Lex/Preprocessor.h
include/clang/Lex/PreprocessorExcludedConditionalDirectiveSkipMapping.h [new file with mode: 0644]
include/clang/Lex/PreprocessorOptions.h
include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h
include/clang/Tooling/DependencyScanning/DependencyScanningService.h
include/clang/Tooling/DependencyScanning/DependencyScanningWorker.h
lib/Lex/DependencyDirectivesSourceMinimizer.cpp
lib/Lex/Lexer.cpp
lib/Lex/PPDirectives.cpp
lib/Lex/Preprocessor.cpp
lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp
lib/Tooling/DependencyScanning/DependencyScanningService.cpp
lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
test/ClangScanDeps/regular_cdb.cpp
tools/clang-scan-deps/ClangScanDeps.cpp
unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp