diff --git a/CMakeLists.txt b/CMakeLists.txt index 6154fdb66f..1ba2a622d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,5 @@ # Clang version information -# Make sure that CMake reconfigures when the version changes. -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/VER - ${CMAKE_CURRENT_BINARY_DIR}/VER) - set(CLANG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(CLANG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) @@ -28,10 +23,9 @@ if( NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR ) endif() endif() -# Compute the Clang version from the contents of VER -file(READ ${CMAKE_CURRENT_SOURCE_DIR}/VER CLANG_VERSION_DATA) +# Compute the Clang version from the LLVM version. string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION - ${CLANG_VERSION_DATA}) + ${PACKAGE_VERSION}) message(STATUS "Clang version: ${CLANG_VERSION}") string(REGEX REPLACE "([0-9]+)\\.[0-9]+(\\.[0-9]+)?" "\\1" CLANG_VERSION_MAJOR diff --git a/VER b/VER deleted file mode 100644 index cd5ac039d6..0000000000 --- a/VER +++ /dev/null @@ -1 +0,0 @@ -2.0 diff --git a/include/clang/Basic/Makefile b/include/clang/Basic/Makefile index 8bbc807a09..7db3e2982a 100644 --- a/include/clang/Basic/Makefile +++ b/include/clang/Basic/Makefile @@ -13,7 +13,11 @@ include $(CLANG_LEVEL)/Makefile INPUT_TDS = $(wildcard $(PROJ_SRC_DIR)/Diagnostic*.td) -CLANG_VERSION := $(shell cat $(PROJ_SRC_DIR)/../../../VER) +# Compute the Clang version from the LLVM version, unless specified explicitly. +ifndef CLANG_VERSION +CLANG_VERSION := $(subst svn,,$(LLVMVersion)) +endif + CLANG_VERSION_COMPONENTS := $(subst ., ,$(CLANG_VERSION)) CLANG_VERSION_MAJOR := $(word 1,$(CLANG_VERSION_COMPONENTS)) CLANG_VERSION_MINOR := $(word 2,$(CLANG_VERSION_COMPONENTS)) @@ -41,7 +45,7 @@ $(ObjDir)/arm_neon.inc.tmp : arm_neon.td $(TBLGEN) $(ObjDir)/.dir $(Echo) "Building Clang arm_neon.inc with tblgen" $(Verb) $(TableGen) -gen-arm-neon-sema -o $(call SYSPATH, $@) $< -$(ObjDir)/Version.inc.tmp : Version.inc.in $(PROJ_SRC_DIR)/../../../VER $(ObjDir)/.dir +$(ObjDir)/Version.inc.tmp : Version.inc.in Makefile $(LLVM_OBJ_ROOT)/Makefile.config $(ObjDir)/.dir $(Echo) "Updating Clang version info." $(Verb)sed -e "s#@CLANG_VERSION@#$(CLANG_VERSION)#g" \ -e "s#@CLANG_VERSION_MAJOR@#$(CLANG_VERSION_MAJOR)#g" \ diff --git a/test/Preprocessor/init.c b/test/Preprocessor/init.c index 28ead97c57..8a3e89e49a 100644 --- a/test/Preprocessor/init.c +++ b/test/Preprocessor/init.c @@ -50,9 +50,9 @@ // COMMON:#define __STDC__ 1 // COMMON:#define __VERSION__ // COMMON:#define __clang__ 1 -// COMMON:#define __clang_major__ 2 -// COMMON:#define __clang_minor__ 0 -// COMMON:#define __clang_patchlevel__ 0 +// COMMON:#define __clang_major__ {{[0-9]+}} +// COMMON:#define __clang_minor__ {{[0-9]+}} +// COMMON:#define __clang_patchlevel__ {{[0-9]+}} // COMMON:#define __clang_version__ // COMMON:#define __llvm__ 1 //