[cfe-dev] Add directives-only preprocessing

Boris Kolpackov via cfe-dev cfe-dev at lists.llvm.org
Thu May 18 01:10:21 PDT 2017


David Blaikie writes:

> If it actually does the same thing as GCC's -fdirectives-only, I'd be happy
> to review a patch to provide that as an alias.

No, they are quite different. GCC's -fdirectives-only expands all the
directives (#ifdef, #warning, etc) while Clang's -frewrite-includes only
expands #include's (it still evaluates #ifdef, etc but does not eliminate
branches not taken).

With GCC you will also need to pass -fdirectives-only to the compilation
stage while with Clang you treat it as a normal source file (so may need
-x c/c++ if compiling as .i/.ii).

Boris



More information about the cfe-dev mailing list