[cfe-commits] r113138 - in /cfe/trunk: include/clang/Driver/Driver.h lib/Driver/Driver.cpp lib/Driver/Tools.cpp tools/driver/driver.cpp

Rafael Espindola rafael.espindola at gmail.com
Sun Sep 5 19:36:23 PDT 2010


Author: rafael
Date: Sun Sep  5 21:36:23 2010
New Revision: 113138

URL: http://llvm.org/viewvc/llvm-project?rev=113138&view=rev
Log:
Make "-ccc-cxx" option work on Linux.
Patch by nobled.

I also took the opportunity to make the field private since now it is only ready from the
outside.

Modified:
    cfe/trunk/include/clang/Driver/Driver.h
    cfe/trunk/lib/Driver/Driver.cpp
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/tools/driver/driver.cpp

Modified: cfe/trunk/include/clang/Driver/Driver.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Driver.h?rev=113138&r1=113137&r2=113138&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Driver.h (original)
+++ cfe/trunk/include/clang/Driver/Driver.h Sun Sep  5 21:36:23 2010
@@ -92,9 +92,6 @@
   /// Information about the host which can be overriden by the user.
   std::string HostBits, HostMachine, HostSystem, HostRelease;
 
-  /// Name to use when calling the generic gcc.
-  std::string CCCGenericGCCName;
-
   /// The file to log CC_PRINT_OPTIONS output to, if enabled.
   const char *CCPrintOptionsFilename;
 
@@ -112,6 +109,9 @@
   unsigned CCPrintOptions : 1;
 
 private:
+  /// Name to use when calling the generic gcc.
+  std::string CCCGenericGCCName;
+
   /// Whether to check that input files exist when constructing compilation
   /// jobs.
   unsigned CheckInputsExist : 1;
@@ -157,6 +157,10 @@
   /// @name Accessors
   /// @{
 
+  /// Name to use when calling the generic gcc.
+  const std::string &getCCCGenericGCCName() const { return CCCGenericGCCName; }
+
+
   const OptTable &getOpts() const { return *Opts; }
 
   const Diagnostic &getDiags() const { return Diags; }

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=113138&r1=113137&r2=113138&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Sun Sep  5 21:36:23 2010
@@ -50,8 +50,8 @@
     DefaultImageName(_DefaultImageName),
     DriverTitle("clang \"gcc-compatible\" driver"),
     Host(0),
-    CCCGenericGCCName("gcc"), CCPrintOptionsFilename(0), CCCIsCXX(false),
-    CCCEcho(false), CCCPrintBindings(false), CCPrintOptions(false),
+    CCPrintOptionsFilename(0), CCCIsCXX(false),
+    CCCEcho(false), CCCPrintBindings(false), CCPrintOptions(false), CCCGenericGCCName("gcc"),
     CheckInputsExist(true), CCCUseClang(true), CCCUseClangCXX(true),
     CCCUseClangCPP(true), CCCUsePCH(true), SuppressMissingInputWarning(false) {
   if (IsProduction) {
@@ -205,6 +205,8 @@
   CCCPrintActions = Args->hasArg(options::OPT_ccc_print_phases);
   CCCPrintBindings = Args->hasArg(options::OPT_ccc_print_bindings);
   CCCIsCXX = Args->hasArg(options::OPT_ccc_cxx) || CCCIsCXX;
+  if (CCCIsCXX)
+    CCCGenericGCCName = "g++";
   CCCEcho = Args->hasArg(options::OPT_ccc_echo);
   if (const Arg *A = Args->getLastArg(options::OPT_ccc_gcc_name))
     CCCGenericGCCName = A->getValue(*Args);

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=113138&r1=113137&r2=113138&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Sun Sep  5 21:36:23 2010
@@ -1619,7 +1619,7 @@
       II.getInputArg().render(Args, CmdArgs);
   }
 
-  const char *GCCName = getToolChain().getDriver().CCCGenericGCCName.c_str();
+  const char *GCCName = getToolChain().getDriver().getCCCGenericGCCName().c_str();
   const char *Exec =
     Args.MakeArgString(getToolChain().GetProgramPath(GCCName));
   C.addCommand(new Command(JA, *this, Exec, CmdArgs));

Modified: cfe/trunk/tools/driver/driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/driver.cpp?rev=113138&r1=113137&r2=113138&view=diff
==============================================================================
--- cfe/trunk/tools/driver/driver.cpp (original)
+++ cfe/trunk/tools/driver/driver.cpp Sun Sep  5 21:36:23 2010
@@ -334,7 +334,6 @@
   if (llvm::StringRef(ProgName).endswith("++") ||
       llvm::StringRef(ProgName).rsplit('-').first.endswith("++")) {
     TheDriver.CCCIsCXX = true;
-    TheDriver.CCCGenericGCCName = "g++";
   }
 
   // Handle CC_PRINT_OPTIONS and CC_PRINT_OPTIONS_FILE.





More information about the cfe-commits mailing list