]> granicus.if.org Git - clang/commitdiff
Make "-ccc-cxx" option work on Linux.
authorRafael Espindola <rafael.espindola@gmail.com>
Mon, 6 Sep 2010 02:36:23 +0000 (02:36 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Mon, 6 Sep 2010 02:36:23 +0000 (02:36 +0000)
Patch by nobled.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113138 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/Driver.h
lib/Driver/Driver.cpp
lib/Driver/Tools.cpp
tools/driver/driver.cpp

index 28eff4f1d71d69ecfab87c3798aa3363e8a3eb6b..1622c4be51e89e0b35c2d7b6ddd0894ce1648e2f 100644 (file)
@@ -92,9 +92,6 @@ public:
   /// 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 @@ public:
   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 @@ public:
   /// @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; }
index 82f913484f481be82b40a0cec7999793ca25b8c8..f5ba96549bac5d73519a5845613a1883721389c5 100644 (file)
@@ -50,8 +50,8 @@ Driver::Driver(llvm::StringRef _ClangExecutable,
     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 @@ Compilation *Driver::BuildCompilation(int argc, const char **argv) {
   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);
index 8436561e6ef92d7e2b33efd4606050a369e31551..a055904a892fc69009b7b810bf37d696ce09d5ac 100644 (file)
@@ -1619,7 +1619,7 @@ void gcc::Common::ConstructJob(Compilation &C, const JobAction &JA,
       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));
index c058ece0dc9b560c08de2983a325a31199df34bf..c1172817ed910ce9eaa969c47381334d325bfb2f 100644 (file)
@@ -334,7 +334,6 @@ int main(int argc_, const char **argv_) {
   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.