[PATCH] D63508: make -frewrite-includes also rewrite conditions in #if/#elif

Luboš Luňák via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 17 01:57:23 PDT 2019


llunak added a comment.

In D63508#1671776 <https://reviews.llvm.org/D63508#1671776>, @torarnv wrote:

> So, this will make `-frewrite-includes` do more work, to ensure that it not only covers the "top level" `#include` or `__has_include` case, but also `__has_include` in one or more levels of macros?
>
> Does that effectively means it needs to do full preprocessing?


This patch does not make -frewrite-includes do any more work. It already does a partial preprocessing run which evaluates all preprocessor directives. The patch just make better use of that information.

> Does it depend on whether `-E` is passed with `-frewrite-includes`?

You cannot pass -frewrite-includes without -E.

> Will this mean that cases like icecream and distcc that use `-frewrite-includes` will have fully preprocessed sources to send to the remote hosts (with correct line/column number when compilation fails), or should they still pass `-D` options during the remote compilation?

The patch does not change anything about the usage. -frewrite-includes still only expands all #include directives and that's it.

> How does `ICECC_REMOTE_CPP` work in this case?

The same way as before. You preferably do nothing, which defaults to ICECC_REMOTE_CPP=1, which uses -frewrite-includes to send full source to the remote, which does full preprocessing and compilation and you get pretty much the same result as if compiling locally. Or you may go with ICECC_REMOTE_CPP=0, which will not do this and then you'll most likely get warnings caused by compiling already preprocessed source. As for ccache, I personally consider suggesting explicit passing of -frewrite-includes to the compilation as somewhat lame; if ccache requires it for the cpp run, it can silently add it under the hood the same way icecream does, or at least it can have it configurable the same as other options and not require messing with build options. I myself use ccache with CCACHE_DEPEND=1, which completely avoids any preprocessor usage.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63508/new/

https://reviews.llvm.org/D63508





More information about the cfe-commits mailing list