Index: clang/include/clang/Basic/Version.inc.in =================================================================== --- clang/include/clang/Basic/Version.inc.in +++ clang/include/clang/Basic/Version.inc.in @@ -1,5 +1,6 @@ #define CLANG_VERSION @CLANG_VERSION@ #define CLANG_VERSION_STRING "@CLANG_VERSION@" #define CLANG_VERSION_MAJOR @CLANG_VERSION_MAJOR@ +#define CLANG_VERSION_MAJOR_STRING "@CLANG_VERSION_MAJOR@" #define CLANG_VERSION_MINOR @CLANG_VERSION_MINOR@ #define CLANG_VERSION_PATCHLEVEL @CLANG_VERSION_PATCHLEVEL@ Index: clang/lib/Driver/Driver.cpp =================================================================== --- clang/lib/Driver/Driver.cpp +++ clang/lib/Driver/Driver.cpp @@ -181,7 +181,7 @@ // ../lib gets us to lib/ in both cases. P = llvm::sys::path::parent_path(Dir); llvm::sys::path::append(P, Twine("lib") + CLANG_LIBDIR_SUFFIX, "clang", - CLANG_VERSION_STRING); + CLANG_VERSION_MAJOR_STRING); } return std::string(P.str()); Index: clang/lib/Headers/CMakeLists.txt =================================================================== --- clang/lib/Headers/CMakeLists.txt +++ clang/lib/Headers/CMakeLists.txt @@ -261,7 +261,7 @@ openmp_wrappers/new ) -set(output_dir ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/include) +set(output_dir ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION_MAJOR}/include) set(out_files) set(generated_files) @@ -418,7 +418,7 @@ add_header_target("windows-resource-headers" ${windows_only_files}) add_header_target("utility-resource-headers" ${utility_files}) -set(header_install_dir lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include) +set(header_install_dir lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION_MAJOR}/include) ############################################################# # Install rules for the catch-all clang-resource-headers target Index: clang/lib/Tooling/CMakeLists.txt =================================================================== --- clang/lib/Tooling/CMakeLists.txt +++ clang/lib/Tooling/CMakeLists.txt @@ -60,7 +60,7 @@ $ # Skip this in debug mode because parsing AST.h is too slow --skip-processing=${skip_expensive_processing} - -I ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION}/include + -I ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION_MAJOR}/include -I ${CLANG_SOURCE_DIR}/include -I ${LLVM_BINARY_DIR}/tools/clang/include -I ${LLVM_BINARY_DIR}/include Index: clang/runtime/CMakeLists.txt =================================================================== --- clang/runtime/CMakeLists.txt +++ clang/runtime/CMakeLists.txt @@ -82,9 +82,9 @@ -DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER} -DLLVM_CONFIG_PATH=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-config -DLLVM_LIT_ARGS=${LLVM_LIT_ARGS} - -DCOMPILER_RT_OUTPUT_DIR=${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION} + -DCOMPILER_RT_OUTPUT_DIR=${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION_MAJOR} -DCOMPILER_RT_EXEC_OUTPUT_DIR=${LLVM_RUNTIME_OUTPUT_INTDIR} - -DCOMPILER_RT_INSTALL_PATH:PATH=lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION} + -DCOMPILER_RT_INSTALL_PATH:PATH=lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION_MAJOR} -DCOMPILER_RT_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX} Index: compiler-rt/cmake/base-config-ix.cmake =================================================================== --- compiler-rt/cmake/base-config-ix.cmake +++ compiler-rt/cmake/base-config-ix.cmake @@ -38,14 +38,14 @@ if (LLVM_TREE_AVAILABLE) # Compute the Clang version from the LLVM version. - # FIXME: We should be able to reuse CLANG_VERSION variable calculated + # FIXME: We should be able to reuse CLANG_VERSION_MAJOR variable calculated # in Clang cmake files, instead of copying the rules here. - string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION + string(REGEX MATCH "^[0-9]+" CLANG_VERSION_MAJOR ${PACKAGE_VERSION}) # Setup the paths where compiler-rt runtimes and headers should be stored. - set(COMPILER_RT_OUTPUT_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}) + set(COMPILER_RT_OUTPUT_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION_MAJOR}) set(COMPILER_RT_EXEC_OUTPUT_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR}) - set(COMPILER_RT_INSTALL_PATH lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}) + set(COMPILER_RT_INSTALL_PATH lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION_MAJOR}) option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests." ${LLVM_INCLUDE_TESTS}) option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered" Index: lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp =================================================================== --- lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp +++ lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp @@ -55,7 +55,7 @@ static const llvm::StringRef kResourceDirSuffixes[] = { // LLVM.org's build of LLDB uses the clang resource directory placed // in $install_dir/lib{,64}/clang/$clang_version. - "lib" CLANG_LIBDIR_SUFFIX "/clang/" CLANG_VERSION_STRING, + "lib" CLANG_LIBDIR_SUFFIX "/clang/" CLANG_VERSION_MAJOR_STRING, // swift-lldb uses the clang resource directory copied from swift, which // by default is placed in $install_dir/lib{,64}/lldb/clang. LLDB places // it there, so we use LLDB_LIBDIR_SUFFIX. Index: lldb/unittests/Expression/ClangParserTest.cpp =================================================================== --- lldb/unittests/Expression/ClangParserTest.cpp +++ lldb/unittests/Expression/ClangParserTest.cpp @@ -37,10 +37,12 @@ TEST_F(ClangHostTest, ComputeClangResourceDirectory) { #if !defined(_WIN32) std::string path_to_liblldb = "/foo/bar/lib/"; - std::string path_to_clang_dir = "/foo/bar/lib" LLDB_LIBDIR_SUFFIX "/clang/" CLANG_VERSION_STRING; + std::string path_to_clang_dir = + "/foo/bar/lib" LLDB_LIBDIR_SUFFIX "/clang/" CLANG_VERSION_MAJOR_STRING; #else std::string path_to_liblldb = "C:\\foo\\bar\\lib"; - std::string path_to_clang_dir = "C:\\foo\\bar\\lib\\clang\\" CLANG_VERSION_STRING; + std::string path_to_clang_dir = + "C:\\foo\\bar\\lib\\clang\\" CLANG_VERSION_MAJOR_STRING; #endif EXPECT_EQ(ComputeClangResourceDir(path_to_liblldb), path_to_clang_dir); Index: llvm/cmake/modules/LLVMExternalProjectUtils.cmake =================================================================== --- llvm/cmake/modules/LLVMExternalProjectUtils.cmake +++ llvm/cmake/modules/LLVMExternalProjectUtils.cmake @@ -255,9 +255,9 @@ set(llvm_config_path ${LLVM_CONFIG_PATH}) if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION + string(REGEX MATCH "^[0-9]+" CLANG_VERSION_MAJOR ${PACKAGE_VERSION}) - set(resource_dir "${LLVM_LIBRARY_DIR}/clang/${CLANG_VERSION}") + set(resource_dir "${LLVM_LIBRARY_DIR}/clang/${CLANG_VERSION_MAJOR}") set(flag_types ASM C CXX MODULE_LINKER SHARED_LINKER EXE_LINKER) foreach(type ${flag_types}) set(${type}_flag -DCMAKE_${type}_FLAGS=-resource-dir=${resource_dir}) Index: openmp/runtime/src/CMakeLists.txt =================================================================== --- openmp/runtime/src/CMakeLists.txt +++ openmp/runtime/src/CMakeLists.txt @@ -352,8 +352,8 @@ if(${OPENMP_STANDALONE_BUILD}) set(LIBOMP_HEADERS_INSTALL_PATH "${CMAKE_INSTALL_INCLUDEDIR}") else() - string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION ${PACKAGE_VERSION}) - set(LIBOMP_HEADERS_INSTALL_PATH "${OPENMP_INSTALL_LIBDIR}/clang/${CLANG_VERSION}/include") + string(REGEX MATCH "^[0-9]+" CLANG_VERSION_MAJOR ${PACKAGE_VERSION}) + set(LIBOMP_HEADERS_INSTALL_PATH "${OPENMP_INSTALL_LIBDIR}/clang/${CLANG_VERSION_MAJOR}/include") endif() if(WIN32) install(TARGETS omp RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") Index: polly/lib/External/isl/interface/extract_interface.cc =================================================================== --- polly/lib/External/isl/interface/extract_interface.cc +++ polly/lib/External/isl/interface/extract_interface.cc @@ -109,7 +109,7 @@ llvm::cl::value_desc("name")); static const char *ResourceDir = - CLANG_PREFIX "/lib/clang/" CLANG_VERSION_STRING; + CLANG_PREFIX "/lib/clang/" CLANG_VERSION_MAJOR_STRING; /* Does decl have an attribute of the following form? *