[cfe-dev] DoPrintPreprocessedInput and predefined macros
rnk at google.com
Thu Jan 16 09:20:00 PST 2014
On Thu, Jan 16, 2014 at 3:05 AM, Robert Ankeney <rrankene at gmail.com> wrote:
> Ping -
> A bit more information about the following - Since preprocessor
> arguments passed can affect what the preprocessor does, is there a way
> to get these arguments to DoPrintPreprocessedInput()? For example
> optimization or the -fno-inline flag affect whether or not
> __NO_INLINE__ is defined.
We could handle this in the driver by adding -D__NO_INLINE__ I suppose.
> Also I see no way to pass something like the
> -ftraditional_cpp flag which affects whitespace handling.
$ clang --help | grep tradi
-traditional-cpp Enable some traditional CPP emulation
> I am using the DoPrintPreprocessedInput() function to preprocess some
> source code, and see a difference from using clang -E -P to do the
> same preprocessing. Using a simple test file:
> #include <stdio.h>
> #include <stdlib.h>
> The difference I see is that the predefined macro __NO_INLINE__ is not
> set when calling DoPrintPreprocessedInput. Is there a way to do this
> other than by calling addMacroDef? Setting UsePredefines to 1 in
> PreprocessorOptions didn't seem to help. Are there other predefines I
> should be concerned with?
> Another thing I noticed is the slow speed of preprocessing the above
> with clang on a Window7 x64 box with MinGW:
> real 0m3.249s
> user 0m0.016s
> sys 0m0.046s
> versus gcc:
> real 0m0.109s
> user 0m0.015s
> sys 0m0.000s
> This is with clang version 3.3 (trunk 176785).
With clang TOT built by MSVC with optimizations and assertions I get:
$ time clang -E t.cpp -P > t
Did you compile with optimizations? Clang, being C++-y, relies pretty
heavily on compiler optimizations in order to get reasonable performance.
> Robert Ankeney
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev