summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlp Toker <alp@nuanti.com>2014-06-06 06:58:25 +0000
committerAlp Toker <alp@nuanti.com>2014-06-06 06:58:25 +0000
commit7ea7c590eb103c9b7b4998b4636f5bef07832550 (patch)
tree0693146992ea72413eeeeb252418ada5e869d51d
parent6e650a52d12a356ff58a79e43d82588e8c64a378 (diff)
downloadclang-7ea7c590eb103c9b7b4998b4636f5bef07832550.tar.gz
clang-7ea7c590eb103c9b7b4998b4636f5bef07832550.tar.bz2
clang-7ea7c590eb103c9b7b4998b4636f5bef07832550.tar.xz
Devise a package-private means to determine the LLVM version string
This will unbreak clang vendor builds as a follow-up to r210238, now that we can't poke into LLVM's private config.h (nor should the string be exposed by llvm-config.h). This hopefully removes for good the last include of LLVM's config.h. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210313 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--CMakeLists.txt3
-rw-r--r--include/clang/Config/config.h.cmake3
-rw-r--r--include/clang/Config/config.h.in5
-rw-r--r--lib/Basic/Version.cpp4
-rw-r--r--lib/Frontend/CompilerInstance.cpp5
5 files changed, 15 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ece6bf8bce..28f4e3fb81 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -156,6 +156,9 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
endif()
set( CLANG_BUILT_STANDALONE 1 )
+ set(BACKEND_PACKAGE_STRING "LLVM ${LLVM_PACKAGE_VERSION}")
+else()
+ set(BACKEND_PACKAGE_STRING "${PACKAGE_STRING}")
endif()
find_package(LibXml2)
diff --git a/include/clang/Config/config.h.cmake b/include/clang/Config/config.h.cmake
index 8fa7a52a3e..40a6cb3a2e 100644
--- a/include/clang/Config/config.h.cmake
+++ b/include/clang/Config/config.h.cmake
@@ -19,4 +19,7 @@
/* Define if we have libxml2 */
#cmakedefine CLANG_HAVE_LIBXML ${CLANG_HAVE_LIBXML}
+/* The LLVM product name and version */
+#define BACKEND_PACKAGE_STRING "${BACKEND_PACKAGE_STRING}"
+
#endif
diff --git a/include/clang/Config/config.h.in b/include/clang/Config/config.h.in
index d66b4cf68d..450ea9b613 100644
--- a/include/clang/Config/config.h.in
+++ b/include/clang/Config/config.h.in
@@ -22,4 +22,9 @@
/* Define if we have libxml2 */
#undef CLANG_HAVE_LIBXML
+#undef PACKAGE_STRING
+
+/* The LLVM product name and version */
+#define BACKEND_PACKAGE_STRING PACKAGE_STRING
+
#endif
diff --git a/lib/Basic/Version.cpp b/lib/Basic/Version.cpp
index ae32c01139..c2b7753d41 100644
--- a/lib/Basic/Version.cpp
+++ b/lib/Basic/Version.cpp
@@ -13,7 +13,7 @@
#include "clang/Basic/Version.h"
#include "clang/Basic/LLVM.h"
-#include "llvm/Config/config.h"
+#include "clang/Config/config.h"
#include "llvm/Support/raw_ostream.h"
#include <cstdlib>
#include <cstring>
@@ -130,7 +130,7 @@ std::string getClangToolFullVersion(StringRef ToolName) {
// If vendor supplied, include the base LLVM version as well.
#ifdef CLANG_VENDOR
- OS << " (based on LLVM " << PACKAGE_VERSION << ")";
+ OS << " (based on " << BACKEND_PACKAGE_STRING << ")";
#endif
return OS.str();
diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp
index a967c0ab54..f5e2749a71 100644
--- a/lib/Frontend/CompilerInstance.cpp
+++ b/lib/Frontend/CompilerInstance.cpp
@@ -16,6 +16,7 @@
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Basic/Version.h"
+#include "clang/Config/config.h"
#include "clang/Frontend/ChainedDiagnosticConsumer.h"
#include "clang/Frontend/FrontendAction.h"
#include "clang/Frontend/FrontendActions.h"
@@ -709,9 +710,7 @@ bool CompilerInstance::ExecuteAction(FrontendAction &Act) {
// Validate/process some options.
if (getHeaderSearchOpts().Verbose)
OS << "clang -cc1 version " CLANG_VERSION_STRING
-#ifdef PACKAGE_STRING
- << " based upon " << PACKAGE_STRING
-#endif
+ << " based upon " << BACKEND_PACKAGE_STRING
<< " default target " << llvm::sys::getDefaultTargetTriple() << "\n";
if (getFrontendOpts().ShowTimers)