diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-04-01 18:21:41 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-04-01 18:21:41 +0000 |
commit | 5d93ed3c7a2dae0a8f422747e269963b3ef11d95 (patch) | |
tree | 37f49fb14b84b530e4661ae89d30a5c5f6257044 | |
parent | 12c0ade49d0063fb651af56e8dda5597c5d780a8 (diff) | |
download | clang-5d93ed3c7a2dae0a8f422747e269963b3ef11d95.tar.gz |
Driver: Add support for a CLANGXX_IS_PRODUCTION build variable, which enable
Clang++ support, even in "Production" mode (for testing purposes).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100119 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | examples/clang-interpreter/main.cpp | 3 | ||||
-rw-r--r-- | include/clang/Driver/Driver.h | 3 | ||||
-rw-r--r-- | lib/Driver/Driver.cpp | 6 | ||||
-rw-r--r-- | lib/Frontend/ASTUnit.cpp | 2 | ||||
-rw-r--r-- | tools/driver/Makefile | 8 | ||||
-rw-r--r-- | tools/driver/driver.cpp | 9 |
6 files changed, 24 insertions, 7 deletions
diff --git a/examples/clang-interpreter/main.cpp b/examples/clang-interpreter/main.cpp index b739b7156b..4eaa1dddc5 100644 --- a/examples/clang-interpreter/main.cpp +++ b/examples/clang-interpreter/main.cpp @@ -71,7 +71,8 @@ int main(int argc, const char **argv, char * const *envp) { Diagnostic Diags(&DiagClient); Driver TheDriver(Path.getBasename(), Path.getDirname(), llvm::sys::getHostTriple(), - "a.out", /*IsProduction=*/false, Diags); + "a.out", /*IsProduction=*/false, /*CXXIsProduction=*/false, + Diags); TheDriver.setTitle("clang interpreter"); // FIXME: This is a hack to try to force the driver to do something we can diff --git a/include/clang/Driver/Driver.h b/include/clang/Driver/Driver.h index 37575fc303..90c3a0dcdc 100644 --- a/include/clang/Driver/Driver.h +++ b/include/clang/Driver/Driver.h @@ -139,7 +139,8 @@ public: Driver(llvm::StringRef _Name, llvm::StringRef _Dir, llvm::StringRef _DefaultHostTriple, llvm::StringRef _DefaultImageName, - bool IsProduction, Diagnostic &_Diags); + bool IsProduction, bool CXXIsProduction, + Diagnostic &_Diags); ~Driver(); /// @name Accessors diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index aa55d39886..921147f7a0 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -45,7 +45,8 @@ using namespace clang; Driver::Driver(llvm::StringRef _Name, llvm::StringRef _Dir, llvm::StringRef _DefaultHostTriple, llvm::StringRef _DefaultImageName, - bool IsProduction, Diagnostic &_Diags) + bool IsProduction, bool CXXIsProduction, + Diagnostic &_Diags) : Opts(createDriverOptTable()), Diags(_Diags), Name(_Name), Dir(_Dir), DefaultHostTriple(_DefaultHostTriple), DefaultImageName(_DefaultImageName), @@ -66,7 +67,8 @@ Driver::Driver(llvm::StringRef _Name, llvm::StringRef _Dir, CCCClangArchs.insert(llvm::Triple::x86_64); CCCClangArchs.insert(llvm::Triple::arm); - CCCUseClangCXX = false; + if (!CXXIsProduction) + CCCUseClangCXX = false; } // Compute the path to the resource directory. diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index 935c415243..7243f709cc 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -378,7 +378,7 @@ ASTUnit *ASTUnit::LoadFromCommandLine(const char **ArgBegin, // FIXME: We shouldn't have to pass in the path info. driver::Driver TheDriver("clang", "/", llvm::sys::getHostTriple(), - "a.out", false, Diags); + "a.out", false, false, Diags); // Don't check that inputs exist, they have been remapped. TheDriver.setCheckInputsExist(false); diff --git a/tools/driver/Makefile b/tools/driver/Makefile index 6434cb4ef5..f88d229d00 100644 --- a/tools/driver/Makefile +++ b/tools/driver/Makefile @@ -11,6 +11,10 @@ LEVEL = ../../../.. TOOLNAME = clang ifndef CLANG_IS_PRODUCTION TOOLALIAS = clang++ +else + ifdef CLANGXX_IS_PRODUCTION + TOOLALIAS = clang++ + endif endif CPP.Flags += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include @@ -33,4 +37,6 @@ include $(LLVM_SRC_ROOT)/Makefile.rules ifdef CLANG_IS_PRODUCTION CPP.Defines += -DCLANG_IS_PRODUCTION endif - +ifdef CLANGXX_IS_PRODUCTION +CPP.Defines += -DCLANGXX_IS_PRODUCTION +endif diff --git a/tools/driver/driver.cpp b/tools/driver/driver.cpp index daab519e95..3f1cca1f88 100644 --- a/tools/driver/driver.cpp +++ b/tools/driver/driver.cpp @@ -197,12 +197,19 @@ int main(int argc, const char **argv) { #ifdef CLANG_IS_PRODUCTION const bool IsProduction = true; +# ifdef CLANGXX_IS_PRODUCTION + const bool CXXIsProduction = true; +# else + const bool CXXIsProduction = false; +# endif #else const bool IsProduction = false; + const bool CXXIsProduction = false; #endif Driver TheDriver(Path.getBasename(), Path.getDirname(), llvm::sys::getHostTriple(), - "a.out", IsProduction, Diags); + "a.out", IsProduction, CXXIsProduction, + Diags); // Check for ".*++" or ".*++-[^-]*" to determine if we are a C++ // compiler. This matches things like "c++", "clang++", and "clang++-1.1". |