[clang-scan-deps] do not skip empty #if/#elif in the minimizer to avoid missing ...
authorAlex Lorenz <arphaman@gmail.com>
Tue, 3 Dec 2019 01:38:40 +0000 (17:38 -0800)
committerAlex Lorenz <arphaman@gmail.com>
Tue, 3 Dec 2019 02:47:22 +0000 (18:47 -0800)
commit389530524be1715e97947810514f3a75dfe73975
treeb7471ae8b9fc2aa5556e6d8980c7c8172ac721d2
parentcf81714a7eb367260f9e6ae5f3bb11bb63d39124
[clang-scan-deps] do not skip empty #if/#elif in the minimizer to avoid missing `__has_include` dependencies

This patch makes the minimizer more conservative to avoid missing dependency files that are brought in by __has_include
PP expressions that occur in a condition of an #if/#elif that was previously skipped. The __has_include PP expressions
can be used in an #if/#elif either directly, or through macro expansion, so we can't detect them at the time of minimization.

Differential Revision: https://reviews.llvm.org/D70936
clang/lib/Lex/DependencyDirectivesSourceMinimizer.cpp
clang/test/ClangScanDeps/Inputs/has_include_if_elif.json [new file with mode: 0644]
clang/test/ClangScanDeps/has_include_if_elif.cpp [new file with mode: 0644]
clang/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp