make -frewrite-includes also rewrite conditions in #if/#elif

Authored by llunak on Sep 18 2019, 12:09 PM.


make -frewrite-includes also rewrite conditions in #if/#elif

Those conditions may use has_include, which needs to be rewritten.
The existing code has already tried to rewrite just
but it didn't work with macro expansion, so e.g. Qt's
"#define QT_HAS_INCLUDE(x) __has_include(x)" didn't get handled
properly. Since the preprocessor run knows what each condition evaluates
to, just rewrite the entire condition. This of course requires that
the -frewrite-include pass has the same setup as the following
compilation, but that has always been the requirement.

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

llvm-svn: 372248