<div dir="ltr"><div><div><div><div>Thanks for the reply!<br><br></div>As for the __NO_INLINE__, you get different results depending on whether you do:<br>clang -E -P t.c<br></div> or<br></div>clang -E -P -O t.c<br></div>
or<br>clang -E -P -traditional-cpp t.c<br><div><br></div><div>Note the only difference between the first and third is the white space is maintained in the third.<br></div><div>So I guess my point is that preprocessing is affected not just by the macro definitions supplied but also by the command line arguments provided. I'm not sure where all that is handled in clang or if it's even feasible to get this information into DoPrintPreprocessedInput.<br>
<br></div><div>As to the performance issue I mentioned, it's probably more to do with the size of the clang executable (about 30 meg) compared with gcc (1.6 meg), as "time clang" takes 1.5 seconds.<br></div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jan 16, 2014 at 6:20 PM, Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jan 16, 2014 at 3:05 AM, Robert Ankeney <span dir="ltr"><<a href="mailto:rrankene@gmail.com" target="_blank">rrankene@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Ping -<br>
<br>
A bit more information about the following - Since preprocessor<br>
arguments passed can affect what the preprocessor does, is there a way<br>
to get these arguments to DoPrintPreprocessedInput()? For example<br>
optimization or the -fno-inline flag affect whether or not<br>
__NO_INLINE__ is defined.</blockquote><div><br></div><div>We could handle this in the driver by adding -D__NO_INLINE__ I suppose.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Also I see no way to pass something like the<br>
-ftraditional_cpp flag which affects whitespace handling.<br></blockquote><div><br></div><div>$ clang --help | grep tradi</div><div> -traditional-cpp Enable some traditional CPP emulation</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
I am using the DoPrintPreprocessedInput() function to preprocess some<br>
source code, and see a difference from using clang -E -P to do the<br>
same preprocessing. Using a simple test file:<br>
#include <stdio.h><br>
#include <stdlib.h><br>
<br>
The difference I see is that the predefined macro __NO_INLINE__ is not<br>
set when calling DoPrintPreprocessedInput. Is there a way to do this<br>
other than by calling addMacroDef? Setting UsePredefines to 1 in<br>
PreprocessorOptions didn't seem to help. Are there other predefines I<br>
should be concerned with?<br>
<br>
Another thing I noticed is the slow speed of preprocessing the above<br>
with clang on a Window7 x64 box with MinGW:<br>
<br>
real 0m3.249s<br>
user 0m0.016s<br>
sys 0m0.046s<br>
<br>
versus gcc:<br>
<br>
real 0m0.109s<br>
user 0m0.015s<br>
sys 0m0.000s<br>
<br>
This is with clang version 3.3 (trunk 176785).<br></blockquote><div><br></div><div>With clang TOT built by MSVC with optimizations and assertions I get:</div><div><div><br></div><div>$ time clang -E t.cpp -P > t</div>
<div>real 0m0.226s</div><div>user 0m0.000s</div><div>sys 0m0.077s</div></div><div><br></div><div>Did you compile with optimizations? Clang, being C++-y, relies pretty heavily on compiler optimizations in order to get reasonable performance.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Thanks,<br>
Robert Ankeney<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div></div>
</blockquote></div><br></div>