[cfe-dev] DoPrintPreprocessedInput and predefined macros

Robert Ankeney rrankene at gmail.com
Mon Dec 30 03:00:52 PST 2013


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).

Thanks,
Robert Ankeney



More information about the cfe-dev mailing list