diff --git a/include/clang/Driver/Driver.h b/include/clang/Driver/Driver.h index 84c373c1204e28197912d44c3342794842b6bff4..c0327a2f1d1c2116cdf274904997dfb6bd9bb1e9 100644 --- a/include/clang/Driver/Driver.h +++ b/include/clang/Driver/Driver.h @@ -115,7 +115,7 @@ public: Driver(const char *_Name, const char *_Dir, const char *_DefaultHostTriple, const char *_DefaultImageName, - Diagnostic &_Diags); + bool IsProduction, Diagnostic &_Diags); ~Driver(); /// @name Accessors diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 1d72b0dbd6e895ab5272dae6c40a6f1f205c0f8a..fd2eb61f75b07db19bad2da120ebee5d80d682c0 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -43,26 +43,28 @@ using namespace clang; Driver::Driver(const char *_Name, const char *_Dir, const char *_DefaultHostTriple, const char *_DefaultImageName, - Diagnostic &_Diags) + bool IsProduction, Diagnostic &_Diags) : Opts(new OptTable()), Diags(_Diags), Name(_Name), Dir(_Dir), DefaultHostTriple(_DefaultHostTriple), DefaultImageName(_DefaultImageName), Host(0), CCCIsCXX(false), CCCEcho(false), CCCPrintBindings(false), CCCGenericGCCName("gcc"), CCCUseClang(true), -#ifdef USE_PRODUCTION_CLANG - CCCUseClangCXX(false), -#else - CCCUseClangCXX(true), -#endif - CCCUseClangCPP(true), CCCUsePCH(true), + CCCUseClangCXX(true), CCCUseClangCPP(true), CCCUsePCH(true), SuppressMissingInputWarning(false) { -#ifdef USE_PRODUCTION_CLANG - // In a "production" build, only use clang on architectures we expect to work. - CCCClangArchs.insert(llvm::Triple::x86); - CCCClangArchs.insert(llvm::Triple::x86_64); - CCCClangArchs.insert(llvm::Triple::arm); -#endif + if (IsProduction) { + // In a "production" build, only use clang on architectures we expect to + // work, and don't use clang C++. + // + // During development its more convenient to always have the driver use + // clang, but we don't want users to be confused when things don't work, or + // to file bugs for things we don't support. + CCCClangArchs.insert(llvm::Triple::x86); + CCCClangArchs.insert(llvm::Triple::x86_64); + CCCClangArchs.insert(llvm::Triple::arm); + + CCCUseClangCXX = false; + } } Driver::~Driver() { diff --git a/tools/driver/Makefile b/tools/driver/Makefile index 8e9c291cc80ca0f695c82f0047f1e3cdb0dc9f55..4b2fb4423445a60dfef57c5942a2d6782dcfcab0 100644 --- a/tools/driver/Makefile +++ b/tools/driver/Makefile @@ -21,3 +21,9 @@ LINK_COMPONENTS := system support bitreader bitwriter USEDLIBS = clangDriver.a clangBasic.a include $(LEVEL)/Makefile.common + +# Translate make variable to define when building a "production" clang. +ifdef CLANG_IS_PRODUCTION +CPP.Defines += -DCLANG_IS_PRODUCTION +endif + diff --git a/tools/driver/driver.cpp b/tools/driver/driver.cpp index a1585009b09e821e812f298ed6ac8cf2408da9d7..9d204ce6c0c23d57f023186f30d3c787c5712c2a 100644 --- a/tools/driver/driver.cpp +++ b/tools/driver/driver.cpp @@ -188,9 +188,14 @@ int main(int argc, const char **argv) { Diagnostic Diags(&DiagClient); +#ifdef CLANG_IS_PRODUCTION + bool IsProduction = true; +#else + bool IsProduction = false; +#endif Driver TheDriver(Path.getBasename().c_str(), Path.getDirname().c_str(), llvm::sys::getHostTriple().c_str(), - "a.out", Diags); + "a.out", IsProduction, Diags); llvm::OwningPtr<Compilation> C;