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.

llvm-svn: 113138
This commit is contained in:
Rafael Espindola 2010-09-06 02:36:23 +00:00
parent ca5a3554b5
commit b2d0d40c3d
4 changed files with 12 additions and 7 deletions

View 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; }

View 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);

View 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));

View 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.