[PATCH] D51391: [clang-cl,PCH] Add support for #pragma hdrstop

Mike Rice via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 4 16:45:11 PDT 2018


mikerice added inline comments.


================
Comment at: lib/Frontend/CompilerInvocation.cpp:2862
+  Opts.PCHWithHdrStopCreate =
+      Args.getLastArgValue(OPT_pch_through_hdrstop_EQ) == "create";
   Opts.PCHThroughHeader = Args.getLastArgValue(OPT_pch_through_header_EQ);
----------------
hans wrote:
> hmm, what if the value is not "create", but also not "use" but something else? maybe that should be diagnosed, or maybe the flag should be split into two?
I am not totally happy with this but I thought one option might be a little better than two.  It would be equivalent to create two options OPT_pch_through_hdrstop_create and OPT_pch_through_hdrstop_use if that seems better (or more usual) to everyone.  I added a diagnostic if the value is not "create" or "use".  A user should never see that though if the front end and driver as in sync.


================
Comment at: lib/Lex/Pragma.cpp:904
+    CurLexer->FormTokenWithChars(Result, CurLexer->BufferEnd, tok::eof);
+    CurLexer->cutOffLexing();
+  }
----------------
hans wrote:
> Nice!
I have to give Nico credit for this.  It's from his patch that I based these changes.


https://reviews.llvm.org/D51391





More information about the cfe-commits mailing list