Skip to content

Commit

Permalink
clang: Derive version name from LLVM unless specified explicitly. Thi…
Browse files Browse the repository at this point in the history
…s means

clang is now clang 2.8.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106914 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
ddunbar committed Jun 25, 2010
1 parent 4d912b2 commit c4b8e92
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
10 changes: 2 additions & 8 deletions 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})

Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion VER

This file was deleted.

8 changes: 6 additions & 2 deletions include/clang/Basic/Makefile
Expand Up @@ -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))
Expand Down Expand Up @@ -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" \
Expand Down
6 changes: 3 additions & 3 deletions test/Preprocessor/init.c
Expand Up @@ -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
//
Expand Down

0 comments on commit c4b8e92

Please sign in to comment.