[PATCH] D18401: clang-cl: Include /FI headers in /showIncludes output.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 23 10:53:07 PDT 2016


rsmith added a subscriber: rsmith.
rsmith accepted this revision.
rsmith added a reviewer: rsmith.
This revision is now accepted and ready to land.

================
Comment at: lib/Frontend/HeaderIncludeGen.cpp:155-156
@@ -151,3 +154,4 @@
 
   // Dump the header include information we are past the predefines buffer or
   // are showing all headers.
+  if (ShowHeader && Reason == PPCallbacks::EnterFile &&
----------------
Missing "if" or similar in this comment?

================
Comment at: lib/Frontend/HeaderIncludeGen.cpp:158
@@ +157,3 @@
+  if (ShowHeader && Reason == PPCallbacks::EnterFile &&
+      strcmp(UserLoc.getFilename(), "<command line>")) {
+    PrintHeaderInfo(OutputFile, UserLoc.getFilename(), ShowDepth, IncludeDepth,
----------------
I'm not a fan of using `strcmp` like this (implicitly converting the result to `bool` to mean "check strings are different"). I'd prefer you used

    UserLoc.getFilename() != StringRef("<command line>")

(Of course, ideally we'd use something more principled than a check against the filename string... please add a FIXME for that.)


http://reviews.llvm.org/D18401





More information about the cfe-commits mailing list