aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-09-06 02:36:23 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-09-06 02:36:23 +0000
commit79e9e9dd533de9609ef141449bf50e705fa68fd0 (patch)
tree8bf86166b83f6b5d950c80655a3350fdd5a925c2
parentfdac7d4f8b94c5005b6f5d21b44548aa182e16ef (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113138 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Driver/Driver.h10
-rw-r--r--lib/Driver/Driver.cpp6
-rw-r--r--lib/Driver/Tools.cpp2
-rw-r--r--tools/driver/driver.cpp1
4 files changed, 12 insertions, 7 deletions
diff --git a/include/clang/Driver/Driver.h b/include/clang/Driver/Driver.h
index 28eff4f1d7..1622c4be51 100644
--- a/include/clang/Driver/Driver.h
+++ b/include/clang/Driver/Driver.h
@@ -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; }
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index 82f913484f..f5ba96549b 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -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);
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 8436561e6e..a055904a89 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -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));
diff --git a/tools/driver/driver.cpp b/tools/driver/driver.cpp
index c058ece0dc..c1172817ed 100644
--- a/tools/driver/driver.cpp
+++ b/tools/driver/driver.cpp
@@ -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.