[PATCH] D11896: [clang-cl] Add support for CL and _CL_ environment variables

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 10 09:55:44 PDT 2015


rnk added inline comments.

================
Comment at: tools/driver/driver.cpp:451
@@ +450,3 @@
+  if (Tokenizer == &llvm::cl::TokenizeWindowsCommandLine) {
+    // The first instance of '#' should be replaced with '='.
+    auto AdjustOpt = [] (const char *Opt) {
----------------
I'd also rather factor this out of driver main, since it's really not important to most readers.

================
Comment at: tools/driver/driver.cpp:452
@@ +451,3 @@
+    // The first instance of '#' should be replaced with '='.
+    auto AdjustOpt = [] (const char *Opt) {
+      if (char *NumberSignPtr = const_cast<char *>(::strchr(Opt, '#')))
----------------
hans wrote:
> Maybe don't take the parameter as a const char* if the constness needs to be dropped for the adjusting to take place? The const_cast could just be moved to where you make the call below.
I think TokenizeCommandLine builds you a list of const strings, unfortunately. We could avoid the cast if we hooked into the tokenization or StringSaver, but it didn't seem worth it.


http://reviews.llvm.org/D11896





More information about the cfe-commits mailing list