[PATCH] clang-cl: Choose executable name base on input name or /Fe

Reid Kleckner rnk at google.com
Mon Aug 12 12:46:10 PDT 2013



================
Comment at: lib/Driver/Driver.cpp:398
@@ +397,3 @@
+
+    if (A->getValue()[0] == '\0') {
+      // It has to have a value.
----------------
grumble grumble getValue() returns a C string.

================
Comment at: lib/Driver/Driver.cpp:401
@@ +400,3 @@
+      Diag(clang::diag::err_drv_missing_argument) << A->getSpelling() << 1;
+      C->getArgs().eraseArg(options::OPT__SLASH_Fe);
+    }
----------------
Fe can actually name a directory in the same way as Fo.  The basename of the image is taken from the first source file, so you can do something like:
cl /Fedir\ myapp.cpp srcs.cpp ...

================
Comment at: lib/Driver/Driver.cpp:1650
@@ +1649,3 @@
+  } else if (JA.getType() == types::TY_Image &&
+      C.getArgs().hasArg(options::OPT__SLASH_Fe)) {
+    // The /Fe flag names the linked file.
----------------
Indent seems off

================
Comment at: lib/Driver/Driver.cpp:1660
@@ +1659,3 @@
+      SmallString<128> Filename = BaseName;
+      if (llvm::sys::path::has_extension(Filename.str()))
+        Filename = Filename.substr(0, Filename.rfind("."));
----------------
This can be path::replace_extension()


http://llvm-reviews.chandlerc.com/D1344



More information about the cfe-commits mailing list