Push "clang-is-production" logic up to tools/driver, and make it hittable by

defining the CLANG_IS_PRODUCTION Makefile variable.

llvm-svn: 82583
This commit is contained in:
Daniel Dunbar 2009-09-22 22:31:13 +00:00
parent 81fff1c358
commit 5564ba743f
4 changed files with 28 additions and 15 deletions

View File

@ -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

View File

@ -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() {

View File

@ -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

View File

@ -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;