diff options
author | Dylan Noblesmith <nobled@dreamwidth.org> | 2011-04-09 13:31:59 +0000 |
---|---|---|
committer | Dylan Noblesmith <nobled@dreamwidth.org> | 2011-04-09 13:31:59 +0000 |
commit | 70e73a3d60b77a1001c97ba2f640f828a695bbfe (patch) | |
tree | a180081f52d642045330653a0fdd743a3503332d /clang/lib/Driver/Tools.cpp | |
parent | 2b6c96b43d3355ac4bff9498d7ec219f00e32323 (diff) | |
download | bcm5719-llvm-70e73a3d60b77a1001c97ba2f640f828a695bbfe.tar.gz bcm5719-llvm-70e73a3d60b77a1001c97ba2f640f828a695bbfe.zip |
refactor -ccc-gcc-name code
Put the logic for deciding the default name for gcc/g++
in the only place that actually cares about it.
This also pushes an ifdef out of the generic driver code
to a little further down, when the target is actually known.
Hopefully it can be changed into just a runtime check
in the future.
llvm-svn: 129212
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index fa7896766d4..20120372974 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -34,6 +34,13 @@ #include "InputInfo.h" #include "ToolChains.h" +#ifdef __CYGWIN__ +#include <cygwin/version.h> +#if defined(CYGWIN_VERSION_DLL_MAJOR) && CYGWIN_VERSION_DLL_MAJOR<1007 +#define IS_CYGWIN15 1 +#endif +#endif + using namespace clang::driver; using namespace clang::driver::tools; @@ -2065,7 +2072,20 @@ void gcc::Common::ConstructJob(Compilation &C, const JobAction &JA, } } - const char *GCCName = getToolChain().getDriver().getCCCGenericGCCName().c_str(); + const std::string customGCCName = D.getCCCGenericGCCName(); + const char *GCCName; + if (!customGCCName.empty()) + GCCName = customGCCName.c_str(); + else if (D.CCCIsCXX) { +#ifdef IS_CYGWIN15 + // FIXME: Detect the version of Cygwin at runtime? + GCCName = "g++-4"; +#else + GCCName = "g++"; +#endif + } else + GCCName = "gcc"; + const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath(GCCName)); C.addCommand(new Command(JA, *this, Exec, CmdArgs)); |