VoltrexMaster updated this revision to Diff 428235.
VoltrexMaster added a comment.

Rebase and add upstream changes.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124147/new/

https://reviews.llvm.org/D124147

Files:
  clang/CMakeLists.txt

Index: clang/CMakeLists.txt
===================================================================
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -1,6 +1,6 @@
 cmake_minimum_required(VERSION 3.13.4)
 
-# If we are not building as a part of LLVM, build Clang as an
+# If we are not building as a part of LLVM, build Clang as a
 # standalone project, using LLVM as an external library:
 if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
   project(Clang)
@@ -11,7 +11,7 @@
 include(GNUInstallDirs)
 
 if(CLANG_BUILT_STANDALONE)
-  set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
+  set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to.")
   set(CMAKE_CXX_STANDARD_REQUIRED YES)
   set(CMAKE_CXX_EXTENSIONS NO)
 
@@ -21,7 +21,7 @@
     set (LLVM_CONFIG_FOUND 1)
     message(STATUS "Found LLVM_CONFIG as ${LLVM_CONFIG}")
     message(DEPRECATION "Using llvm-config to detect the LLVM installation is \
-          deprecated.  The installed cmake files should be used \
+          deprecated.  The installed CMake files should be used \
           instead.  CMake should be able to detect your LLVM install \
           automatically, but you can also use LLVM_DIR to specify \
           the path containing LLVMConfig.cmake.")
@@ -65,7 +65,7 @@
 
   if(NOT MSVC_IDE)
     set(LLVM_ENABLE_ASSERTIONS ${ENABLE_ASSERTIONS}
-      CACHE BOOL "Enable assertions")
+      CACHE BOOL "Enable assertions.")
     # Assertions should follow llvm-config's.
     mark_as_advanced(LLVM_ENABLE_ASSERTIONS)
   endif()
@@ -75,7 +75,7 @@
 
   # We can't check LLVM_CONFIG here, because find_package(LLVM ...) also sets
   # LLVM_CONFIG.
-  if (NOT LLVM_CONFIG_FOUND)
+  if(NOT LLVM_CONFIG_FOUND)
     # Pull values from LLVMConfig.cmake.  We can drop this once the llvm-config
     # path is removed.
     set(MAIN_INCLUDE_DIR "${LLVM_INCLUDE_DIR}")
@@ -86,11 +86,11 @@
     set(LIBRARY_DIR "${LLVM_LIBRARY_DIR}")
   endif()
 
-  set(LLVM_MAIN_INCLUDE_DIR "${MAIN_INCLUDE_DIR}" CACHE PATH "Path to llvm/include")
-  set(LLVM_BINARY_DIR "${LLVM_OBJ_ROOT}" CACHE PATH "Path to LLVM build tree")
-  set(LLVM_MAIN_SRC_DIR "${MAIN_SRC_DIR}" CACHE PATH "Path to LLVM source tree")
-  set(LLVM_TOOLS_BINARY_DIR "${TOOLS_BINARY_DIR}" CACHE PATH "Path to llvm/bin")
-  set(LLVM_LIBRARY_DIR "${LIBRARY_DIR}" CACHE PATH "Path to llvm/lib")
+  set(LLVM_MAIN_INCLUDE_DIR "${MAIN_INCLUDE_DIR}" CACHE PATH "Path to llvm/include.")
+  set(LLVM_BINARY_DIR "${LLVM_OBJ_ROOT}" CACHE PATH "Path to LLVM build tree.")
+  set(LLVM_MAIN_SRC_DIR "${MAIN_SRC_DIR}" CACHE PATH "Path to LLVM source tree.")
+  set(LLVM_TOOLS_BINARY_DIR "${TOOLS_BINARY_DIR}" CACHE PATH "Path to llvm/bin.")
+  set(LLVM_LIBRARY_DIR "${LIBRARY_DIR}" CACHE PATH "Path to llvm/lib.")
 
   find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR}
     NO_DEFAULT_PATH)
@@ -110,7 +110,7 @@
 
   option(LLVM_FORCE_USE_OLD_HOST_TOOLCHAIN
     "Set to ON to force using an old, unsupported host toolchain." OFF)
-  option(CLANG_ENABLE_BOOTSTRAP "Generate the clang bootstrap target" OFF)
+  option(CLANG_ENABLE_BOOTSTRAP "Generate the Clang bootstrap target." OFF)
   option(LLVM_ENABLE_LIBXML2 "Use libxml2 if available." ON)
 
   include(AddLLVM)
@@ -124,16 +124,16 @@
   set(BUG_REPORT_URL "${LLVM_PACKAGE_BUGREPORT}" CACHE STRING
     "Default URL where bug reports are to be submitted.")
 
-  if (NOT DEFINED LLVM_INCLUDE_TESTS)
+  if(NOT DEFINED LLVM_INCLUDE_TESTS)
     set(LLVM_INCLUDE_TESTS ON)
   endif()
 
   include_directories("${LLVM_BINARY_DIR}/include" "${LLVM_MAIN_INCLUDE_DIR}")
   link_directories("${LLVM_LIBRARY_DIR}")
 
-  set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
-  set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
-  set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
+  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
+  set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
+  set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
 
   if(LLVM_INCLUDE_TESTS)
     find_package(Python3 ${LLVM_MINIMUM_PYTHON_VERSION} REQUIRED
@@ -147,7 +147,7 @@
     endif()
 
     if(EXISTS ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py)
-      # Note: path not really used, except for checking if lit was found
+      # Note: path not really used, except for checking if Lit was found.
       set(LLVM_LIT ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py)
       if(EXISTS ${LLVM_MAIN_SRC_DIR}/utils/llvm-lit)
         add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/llvm-lit utils/llvm-lit)
@@ -170,7 +170,7 @@
       find_program(LLVM_LIT
                    NAMES llvm-lit lit.py lit
                    PATHS "${LLVM_MAIN_SRC_DIR}/utils/lit"
-                   DOC "Path to lit.py")
+                   DOC "Path to lit.py.")
     endif()
 
     if(LLVM_LIT)
@@ -180,13 +180,13 @@
       if (MSVC OR XCODE)
         set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
       endif()
-      set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit")
+      set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for Lit.")
 
       get_errc_messages(LLVM_LIT_ERRC_MESSAGES)
 
       # On Win32 hosts, provide an option to specify the path to the GnuWin32 tools.
-      if( WIN32 AND NOT CYGWIN )
-        set(LLVM_LIT_TOOLS_DIR "" CACHE PATH "Path to GnuWin32 tools")
+      if(WIN32 AND NOT CYGWIN)
+        set(LLVM_LIT_TOOLS_DIR "" CACHE PATH "Path to GnuWin32 tools.")
       endif()
     else()
       set(LLVM_INCLUDE_TESTS OFF)
@@ -198,26 +198,25 @@
   set(BACKEND_PACKAGE_STRING "LLVM ${LLVM_PACKAGE_VERSION}")
 else()
   set(BACKEND_PACKAGE_STRING "${PACKAGE_STRING}")
-endif() # standalone
+endif() # Standalone
 
 if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
   set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
 endif()
 
-# Make sure that our source directory is on the current cmake module path so that
-# we can include cmake files from this directory.
+# Make sure that our source directory is on the current CMake module path so that
+# we can include CMake files from this directory.
 list(INSERT CMAKE_MODULE_PATH 0
   "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
-  "${LLVM_COMMON_CMAKE_UTILS}/Modules"
-  )
+  "${LLVM_COMMON_CMAKE_UTILS}/Modules")
 
 if(LLVM_ENABLE_LIBXML2)
   # Don't look for libxml if we're using MSan, since uninstrumented third party
   # code may call MSan interceptors like strlen, leading to false positives.
   if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*")
-    set (LIBXML2_FOUND 0)
+    set(LIBXML2_FOUND 0)
     find_package(LibXml2 2.5.3 QUIET)
-    if (LIBXML2_FOUND)
+    if(LIBXML2_FOUND)
       set(CLANG_HAVE_LIBXML 1)
     endif()
   endif()
@@ -230,28 +229,28 @@
   "Relative directory from the Clang binary to its resource files.")
 
 set(C_INCLUDE_DIRS "" CACHE STRING
-  "Colon separated list of directories clang will search for headers.")
+  "Colon separated list of directories Clang will search for headers.")
 
-set(GCC_INSTALL_PREFIX "" CACHE PATH "Directory where gcc is installed." )
+set(GCC_INSTALL_PREFIX "" CACHE PATH "Directory where GCC is installed.")
 set(DEFAULT_SYSROOT "" CACHE STRING
-  "Default <path> to all compiler invocations for --sysroot=<path>." )
+  "Default <path> to all compiler invocations for --sysroot=<path>.")
 
-set(ENABLE_LINKER_BUILD_ID OFF CACHE BOOL "pass --build-id to ld")
+set(ENABLE_LINKER_BUILD_ID OFF CACHE BOOL "Pass --build-id to ld.")
 
 set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL
-    "enable x86 relax relocations by default")
+    "Enable x86 relax relocations by default.")
 
 set(PPC_LINUX_DEFAULT_IEEELONGDOUBLE OFF CACHE BOOL
     "Enable IEEE binary128 as default long double format on PowerPC Linux.")
 
 set(CLANG_SPAWN_CC1 OFF CACHE BOOL
-    "Whether clang should use a new process for the CC1 invocation")
+    "Whether Clang should use a new process for the CC1 invocation.")
 
-option(CLANG_DEFAULT_PIE_ON_LINUX "Default to -fPIE and -pie on linux-gnu" ON)
+option(CLANG_DEFAULT_PIE_ON_LINUX "Default to -fPIE and -pie on linux-gnu." ON)
 
 # Manually handle default so we can change the meaning of a cached default.
 set(CLANG_ENABLE_OPAQUE_POINTERS "DEFAULT" CACHE STRING
-    "Enable opaque pointers by default")
+    "Enable opaque pointers by default.")
 if(CLANG_ENABLE_OPAQUE_POINTERS STREQUAL "DEFAULT")
   set(CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL ON)
 elseif(CLANG_ENABLE_OPAQUE_POINTERS)
@@ -262,48 +261,48 @@
 
 # TODO: verify the values against LangStandards.def?
 set(CLANG_DEFAULT_STD_C "" CACHE STRING
-  "Default standard to use for C/ObjC code (IDENT from LangStandards.def, empty for platform default)")
+  "Default standard to use for C/ObjC code (IDENT from LangStandards.def, empty for platform default).")
 set(CLANG_DEFAULT_STD_CXX "" CACHE STRING
-  "Default standard to use for C++/ObjC++ code (IDENT from LangStandards.def, empty for platform default)")
+  "Default standard to use for C++/ObjC++ code (IDENT from LangStandards.def, empty for platform default).")
 
 set(CLANG_DEFAULT_LINKER "" CACHE STRING
-  "Default linker to use (linker name or absolute path, empty for platform default)")
+  "Default linker to use (linker name or absolute path, empty for platform default).")
 
 set(CLANG_DEFAULT_CXX_STDLIB "" CACHE STRING
-  "Default C++ stdlib to use (\"libstdc++\" or \"libc++\", empty for platform default")
-if (NOT(CLANG_DEFAULT_CXX_STDLIB STREQUAL "" OR
+  "Default C++ stdlib to use (\"libstdc++\" or \"libc++\", empty for platform default).")
+if(NOT(CLANG_DEFAULT_CXX_STDLIB STREQUAL "" OR
         CLANG_DEFAULT_CXX_STDLIB STREQUAL "libstdc++" OR
         CLANG_DEFAULT_CXX_STDLIB STREQUAL "libc++"))
-  message(WARNING "Resetting default C++ stdlib to use platform default")
+  message(WARNING "Resetting default C++ stdlib to use platform default...")
   set(CLANG_DEFAULT_CXX_STDLIB "" CACHE STRING
-    "Default C++ stdlib to use (\"libstdc++\" or \"libc++\", empty for platform default" FORCE)
+    "Default C++ stdlib to use (\"libstdc++\" or \"libc++\", empty for platform default)." FORCE)
 endif()
 
 set(CLANG_DEFAULT_RTLIB "" CACHE STRING
-  "Default runtime library to use (\"libgcc\" or \"compiler-rt\", empty for platform default)")
-if (NOT(CLANG_DEFAULT_RTLIB STREQUAL "" OR
+  "Default runtime library to use (\"libgcc\" or \"compiler-rt\", empty for platform default).")
+if(NOT(CLANG_DEFAULT_RTLIB STREQUAL "" OR
         CLANG_DEFAULT_RTLIB STREQUAL "libgcc" OR
         CLANG_DEFAULT_RTLIB STREQUAL "compiler-rt"))
-  message(WARNING "Resetting default rtlib to use platform default")
+  message(WARNING "Resetting default rtlib to use platform default...")
   set(CLANG_DEFAULT_RTLIB "" CACHE STRING
-    "Default runtime library to use (\"libgcc\" or \"compiler-rt\", empty for platform default)" FORCE)
+    "Default runtime library to use (\"libgcc\" or \"compiler-rt\", empty for platform default)." FORCE)
 endif()
 
 set(CLANG_DEFAULT_UNWINDLIB "" CACHE STRING
-  "Default unwind library to use (\"none\" \"libgcc\" or \"libunwind\", empty to match runtime library.)")
-if (CLANG_DEFAULT_UNWINDLIB STREQUAL "")
-  if (CLANG_DEFAULT_RTLIB STREQUAL "libgcc")
-    set (CLANG_DEFAULT_UNWINDLIB "libgcc" CACHE STRING "" FORCE)
+  "Default unwind library to use (\"none\", \"libgcc\" or \"libunwind\", empty to match runtime library).")
+if(CLANG_DEFAULT_UNWINDLIB STREQUAL "")
+  if(CLANG_DEFAULT_RTLIB STREQUAL "libgcc")
+    set(CLANG_DEFAULT_UNWINDLIB "libgcc" CACHE STRING "" FORCE)
   endif()
 endif()
 
-if (NOT(CLANG_DEFAULT_UNWINDLIB STREQUAL "" OR
+if(NOT(CLANG_DEFAULT_UNWINDLIB STREQUAL "" OR
         CLANG_DEFAULT_UNWINDLIB STREQUAL "none" OR
         CLANG_DEFAULT_UNWINDLIB STREQUAL "libgcc" OR
         CLANG_DEFAULT_UNWINDLIB STREQUAL "libunwind"))
-  message(WARNING "Resetting default unwindlib to use platform default")
+  message(WARNING "Resetting default unwindlib to use platform default...")
   set(CLANG_DEFAULT_UNWINDLIB "" CACHE STRING
-    "Default unwind library to use (\"none\" \"libgcc\" or \"libunwind\", empty to match runtime library.)" FORCE)
+    "Default unwind library to use (\"none\", \"libgcc\" or \"libunwind\", empty to match runtime library)." FORCE)
 endif()
 
 set(CLANG_DEFAULT_OBJCOPY "objcopy" CACHE STRING
@@ -317,10 +316,10 @@
 # 64-bit integers in the implementation of conditional lastprivate.
 set(CUDA_ARCH_FLAGS "sm_35")
 
-# Try to find the highest Nvidia GPU architecture the system supports
-if (NOT DEFINED CLANG_OPENMP_NVPTX_DEFAULT_ARCH)
+# Try to find the highest NVIDIA GPU architecture the system supports.
+if(NOT DEFINED CLANG_OPENMP_NVPTX_DEFAULT_ARCH)
   find_package(CUDA QUIET)
-  if (CUDA_FOUND)
+  if(CUDA_FOUND)
     cuda_select_nvcc_arch_flags(CUDA_ARCH_FLAGS)
   endif()
 else()
@@ -328,16 +327,16 @@
 endif()
 
 string(REGEX MATCH "sm_([0-9]+)" CUDA_ARCH_MATCH ${CUDA_ARCH_FLAGS})
-if (NOT DEFINED CUDA_ARCH_MATCH OR "${CMAKE_MATCH_1}" LESS 35)
+if(NOT DEFINED CUDA_ARCH_MATCH OR "${CMAKE_MATCH_1}" LESS 35)
   set(CLANG_OPENMP_NVPTX_DEFAULT_ARCH "sm_35" CACHE STRING
-    "Default architecture for OpenMP offloading to Nvidia GPUs." FORCE)
-  message(WARNING "Resetting default architecture for OpenMP offloading to Nvidia GPUs to sm_35")
+    "Default architecture for OpenMP offloading to NVIDIA GPUs." FORCE)
+  message(WARNING "Resetting default architecture for OpenMP offloading to NVIDIA GPUs to sm_35...")
 else()
   set(CLANG_OPENMP_NVPTX_DEFAULT_ARCH ${CUDA_ARCH_MATCH} CACHE STRING
-    "Default architecture for OpenMP offloading to Nvidia GPUs.")
+    "Default architecture for OpenMP offloading to NVIDIA GPUs.")
 endif()
 
-set(CLANG_SYSTEMZ_DEFAULT_ARCH "z10" CACHE STRING "SystemZ Default Arch")
+set(CLANG_SYSTEMZ_DEFAULT_ARCH "z10" CACHE STRING "SystemZ default arch.")
 
 set(CLANG_VENDOR ${PACKAGE_VENDOR} CACHE STRING
   "Vendor-specific text for showing with version information.")
@@ -350,17 +349,17 @@
 endif()
 
 set(CLANG_VENDOR_UTI "org.llvm.clang" CACHE STRING
-  "Vendor-specific uti.")
+  "Vendor-specific UTI.")
 
 set(CLANG_PYTHON_BINDINGS_VERSIONS "" CACHE STRING
-    "Python versions to install libclang python bindings for")
+    "Python versions to install libclang Python bindings for.")
 
 set(CLANG_LINK_CLANG_DYLIB ${LLVM_LINK_LLVM_DYLIB} CACHE BOOL
-    "Link tools against libclang-cpp.so")
+    "Link tools against libclang-cpp.so.")
 
-if (NOT LLVM_LINK_LLVM_DYLIB AND CLANG_LINK_CLANG_DYLIB)
+if(NOT LLVM_LINK_LLVM_DYLIB AND CLANG_LINK_CLANG_DYLIB)
   message(FATAL_ERROR "Cannot set CLANG_LINK_CLANG_DYLIB=ON when "
-                      "LLVM_LINK_LLVM_DYLIB=OFF")
+                      "LLVM_LINK_LLVM_DYLIB=OFF.")
 endif()
 
 # The libdir suffix must exactly match whatever LLVM's configuration used.
@@ -369,12 +368,12 @@
 set(CLANG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
 set(CLANG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
 
-if( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE )
+if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE)
   message(FATAL_ERROR "In-source builds are not allowed. "
-"Please create a directory and run cmake "
-"from there, passing the path to this source directory as the last argument. "
-"This process created the file `CMakeCache.txt' and the directory "
-"`CMakeFiles'. Please delete them.")
+    "Please create a directory and run CMake "
+    "from there, passing the path to this source directory as the last argument. "
+    "This process created the file `CMakeCache.txt' and the directory "
+    "`CMakeFiles'. Please delete them.")
 endif()
 
 # If CLANG_VERSION_* is specified, use it, if not use LLVM_VERSION_*.
@@ -396,39 +395,39 @@
   ${CMAKE_CURRENT_SOURCE_DIR}/include/clang/Basic/Version.inc.in
   ${CMAKE_CURRENT_BINARY_DIR}/include/clang/Basic/Version.inc)
 
-# Add appropriate flags for GCC
-if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
+# Add appropriate flags for GCC.
+if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-common -Woverloaded-virtual")
-  if (NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
+  if(NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
-  endif ()
+  endif()
 
   # Enable -pedantic for Clang even if it's not enabled for LLVM.
-  if (NOT LLVM_ENABLE_PEDANTIC)
+  if(NOT LLVM_ENABLE_PEDANTIC)
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wno-long-long")
-  endif ()
+  endif()
 
   check_cxx_compiler_flag("-Werror -Wnested-anon-types" CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG)
-  if( CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG )
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nested-anon-types" )
+  if(CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG)
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nested-anon-types")
   endif()
-endif ()
+endif()
 
 # Determine HOST_LINK_VERSION on Darwin.
 set(HOST_LINK_VERSION)
-if (APPLE AND NOT CMAKE_LINKER MATCHES ".*lld.*")
+if(APPLE AND NOT CMAKE_LINKER MATCHES ".*lld.*")
   set(LD_V_OUTPUT)
   execute_process(
     COMMAND sh -c "${CMAKE_LINKER} -v 2>&1 | head -1"
     RESULT_VARIABLE HAD_ERROR
     OUTPUT_VARIABLE LD_V_OUTPUT
   )
-  if (HAD_ERROR)
+  if(HAD_ERROR)
     message(FATAL_ERROR "${CMAKE_LINKER} failed with status ${HAD_ERROR}")
   endif()
-  if ("${LD_V_OUTPUT}" MATCHES ".*ld64-([0-9.]+).*")
+  if("${LD_V_OUTPUT}" MATCHES ".*ld64-([0-9.]+).*")
     string(REGEX REPLACE ".*ld64-([0-9.]+).*" "\\1" HOST_LINK_VERSION ${LD_V_OUTPUT})
-  elseif ("${LD_V_OUTPUT}" MATCHES "[^0-9]*([0-9.]+).*")
+  elseif("${LD_V_OUTPUT}" MATCHES "[^0-9]*([0-9.]+).*")
     string(REGEX REPLACE "[^0-9]*([0-9.]+).*" "\\1" HOST_LINK_VERSION ${LD_V_OUTPUT})
   endif()
   message(STATUS "Host linker version: ${HOST_LINK_VERSION}")
@@ -441,18 +440,16 @@
 
 include_directories(BEFORE
   ${CMAKE_CURRENT_BINARY_DIR}/include
-  ${CMAKE_CURRENT_SOURCE_DIR}/include
-  )
+  ${CMAKE_CURRENT_SOURCE_DIR}/include)
 
-if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+if(NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
   install(DIRECTORY include/clang include/clang-c
     DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
     COMPONENT clang-headers
     FILES_MATCHING
     PATTERN "*.def"
     PATTERN "*.h"
-    PATTERN "config.h" EXCLUDE
-    )
+    PATTERN "config.h" EXCLUDE)
 
   install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/clang
     DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
@@ -460,8 +457,7 @@
     FILES_MATCHING
     PATTERN "CMakeFiles" EXCLUDE
     PATTERN "*.inc"
-    PATTERN "*.h"
-    )
+    PATTERN "*.h")
 
   # Installing the headers needs to depend on generating any public
   # tablegen'd headers.
@@ -484,7 +480,7 @@
   endif()
 endif()
 
-add_definitions( -D_GNU_SOURCE )
+add_definitions(-D_GNU_SOURCE)
 
 option(CLANG_BUILD_TOOLS
   "Build the Clang tools. If OFF, just generate build targets." ON)
@@ -495,30 +491,30 @@
   set(HAVE_CLANG_PLUGIN_SUPPORT OFF)
 endif()
 CMAKE_DEPENDENT_OPTION(CLANG_PLUGIN_SUPPORT
-  "Build clang with plugin support" ON
+  "Build Clang with plugin support." ON
   "HAVE_CLANG_PLUGIN_SUPPORT" OFF)
 
 option(CLANG_ENABLE_ARCMT "Build ARCMT." ON)
 option(CLANG_ENABLE_STATIC_ANALYZER
-  "Include static analyzer in clang binary." ON)
+  "Include static analyzer in Clang binary." ON)
 
 option(CLANG_ENABLE_PROTO_FUZZER "Build Clang protobuf fuzzer." OFF)
 
 if(NOT CLANG_ENABLE_STATIC_ANALYZER AND CLANG_ENABLE_ARCMT)
-  message(FATAL_ERROR "Cannot disable static analyzer while enabling ARCMT or Z3")
+  message(FATAL_ERROR "Cannot disable static analyzer while enabling ARCMT or Z3.")
 endif()
 
 if(CLANG_ENABLE_ARCMT)
   set(CLANG_ENABLE_OBJC_REWRITER ON)
 endif()
 
-# Clang version information
+# Clang version information.
 set(CLANG_EXECUTABLE_VERSION
     "${CLANG_VERSION_MAJOR}" CACHE STRING
-    "Major version number that will be appended to the clang executable name")
+    "Major version number that will be appended to the Clang executable name.")
 set(LIBCLANG_LIBRARY_VERSION
     "${CLANG_VERSION_MAJOR}" CACHE STRING
-    "Major version number that will be appended to the libclang library")
+    "Major version number that will be appended to the libclang library.")
 mark_as_advanced(CLANG_EXECUTABLE_VERSION LIBCLANG_LIBRARY_VERSION)
 
 option(CLANG_INCLUDE_TESTS
@@ -549,12 +545,12 @@
 add_subdirectory(tools)
 add_subdirectory(runtime)
 
-option(CLANG_BUILD_EXAMPLES "Build CLANG example programs by default." OFF)
+option(CLANG_BUILD_EXAMPLES "Build Clang example programs by default." OFF)
 add_subdirectory(examples)
 
 if(APPLE)
-  # this line is needed as a cleanup to ensure that any CMakeCaches with the old
-  # default value get updated to the new default.
+  # This line is needed as a cleanup to ensure that any CMakeCaches with the old
+  # default value gets updated to the new default.
   if(CLANG_ORDER_FILE STREQUAL "")
     unset(CLANG_ORDER_FILE CACHE)
     unset(CLANG_ORDER_FILE)
@@ -562,7 +558,7 @@
 
 
   set(CLANG_ORDER_FILE ${CMAKE_CURRENT_BINARY_DIR}/clang.order CACHE FILEPATH
-    "Order file to use when compiling clang in order to improve startup time (Darwin Only - requires ld64).")
+    "Order file to use when compiling Clang in order to improve startup time (Darwin Only - requires ld64).")
 
   if(NOT EXISTS ${CLANG_ORDER_FILE})
     string(FIND "${CLANG_ORDER_FILE}" "${CMAKE_CURRENT_BINARY_DIR}" PATH_START)
@@ -580,25 +576,38 @@
     add_subdirectory(unittests)
     list(APPEND CLANG_TEST_DEPS ClangUnitTests)
     list(APPEND CLANG_TEST_PARAMS
-      clang_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/test/Unit/lit.site.cfg
-      )
+      clang_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/test/Unit/lit.site.cfg)
   endif()
   add_subdirectory(test)
   add_subdirectory(bindings/python/tests)
 
   if(CLANG_BUILT_STANDALONE)
     umbrella_lit_testsuite_end(check-all)
+    # Add a global check rule now that all subdirectories have been traversed
+    # and we know the total set of Lit testsuites.
+    get_property(LLVM_LIT_TESTSUITES GLOBAL PROPERTY LLVM_LIT_TESTSUITES)
+    get_property(LLVM_LIT_PARAMS GLOBAL PROPERTY LLVM_LIT_PARAMS)
+    get_property(LLVM_LIT_DEPENDS GLOBAL PROPERTY LLVM_LIT_DEPENDS)
+    get_property(LLVM_LIT_EXTRA_ARGS GLOBAL PROPERTY LLVM_LIT_EXTRA_ARGS)
+    get_property(LLVM_ADDITIONAL_TEST_TARGETS
+                 GLOBAL PROPERTY LLVM_ADDITIONAL_TEST_TARGETS)
+    add_lit_target(check-all
+      "Running all regression tests"
+      ${LLVM_LIT_TESTSUITES}
+      PARAMS ${LLVM_LIT_PARAMS}
+      DEPENDS ${LLVM_LIT_DEPENDS} ${LLVM_ADDITIONAL_TEST_TARGETS}
+      ARGS ${LLVM_LIT_EXTRA_ARGS})
   endif()
   add_subdirectory(utils/perf-training)
 endif()
 
 option(CLANG_INCLUDE_DOCS "Generate build targets for the Clang docs."
   ${LLVM_INCLUDE_DOCS})
-if( CLANG_INCLUDE_DOCS )
+if(CLANG_INCLUDE_DOCS)
   add_subdirectory(docs)
 endif()
 
-# Custom target to install all clang libraries.
+# Custom target to install all Clang libraries.
 add_custom_target(clang-libraries)
 set_target_properties(clang-libraries PROPERTIES FOLDER "Misc")
 
@@ -626,7 +635,7 @@
   message(STATUS "Setting current clang stage to: ${CLANG_STAGE}")
 endif()
 
-if (CLANG_ENABLE_BOOTSTRAP)
+if(CLANG_ENABLE_BOOTSTRAP)
   include(ExternalProject)
 
   add_custom_target(clang-bootstrap-deps DEPENDS clang)
@@ -650,31 +659,31 @@
   if(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED)
     set(NEXT_CLANG_STAGE ${NEXT_CLANG_STAGE}-instrumented)
   endif()
-  message(STATUS "Setting next clang stage to: ${NEXT_CLANG_STAGE}")
+  message(STATUS "Setting next Clang stage to: ${NEXT_CLANG_STAGE}")
 
 
   set(STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-stamps/)
   set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-bins/)
 
   if(BOOTSTRAP_LLVM_ENABLE_LLD)
-    # adding lld to clang-bootstrap-deps without having it enabled in
+    # Adding lld to clang-bootstrap-deps without having it enabled in
     # LLVM_ENABLE_PROJECTS just generates a cryptic error message.
-    if (NOT "lld" IN_LIST LLVM_ENABLE_PROJECTS)
+    if(NOT "lld" IN_LIST LLVM_ENABLE_PROJECTS)
       message(FATAL_ERROR "LLD is enabled in the bootstrap build, but lld is not in LLVM_ENABLE_PROJECTS")
     endif()
     add_dependencies(clang-bootstrap-deps lld)
   endif()
 
-  # If the next stage is LTO we need to depend on LTO and possibly lld or LLVMgold
+  # If the next stage is LTO we need to depend on LTO and possibly LLD or LLVMgold.
   if(BOOTSTRAP_LLVM_ENABLE_LTO OR LLVM_ENABLE_LTO AND NOT LLVM_BUILD_INSTRUMENTED)
     if(APPLE)
       add_dependencies(clang-bootstrap-deps LTO)
       # on Darwin we need to set DARWIN_LTO_LIBRARY so that -flto will work
       # using the just-built compiler, and we need to override DYLD_LIBRARY_PATH
       # so that the host object file tools will use the just-built libLTO.
-      # However if System Integrity Protection is enabled the DYLD variables
+      # However if System Integrity Protection is enabled, the DYLD variables
       # will be scrubbed from the environment of any base system commands. This
-      # includes /bin/sh, which ninja uses when executing build commands. To
+      # includes /bin/sh, which Ninja uses when executing build commands. To
       # work around the envar being filtered away we pass it in as a CMake
       # variable, and have LLVM's CMake append the envar to the archiver calls.
       set(LTO_LIBRARY -DDARWIN_LTO_LIBRARY=${LLVM_SHLIB_OUTPUT_INTDIR}/libLTO.dylib
@@ -694,8 +703,7 @@
   endif()
 
   add_custom_target(${NEXT_CLANG_STAGE}-clear
-    DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-cleared
-    )
+    DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-cleared)
   add_custom_command(
     OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-cleared
     DEPENDS clang-bootstrap-deps
@@ -703,8 +711,7 @@
     COMMAND ${CMAKE_COMMAND} -E make_directory ${BINARY_DIR}
     COMMAND ${CMAKE_COMMAND} -E remove_directory ${STAMP_DIR}
     COMMAND ${CMAKE_COMMAND} -E make_directory ${STAMP_DIR}
-    COMMENT "Clobberring ${NEXT_CLANG_STAGE} build and stamp directories"
-    )
+    COMMENT "Clobberring ${NEXT_CLANG_STAGE} build and stamp directories...")
 
   if(CMAKE_VERBOSE_MAKEFILE)
     set(verbose -DCMAKE_VERBOSE_MAKEFILE=On)
@@ -755,7 +762,7 @@
     -DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/${C_COMPILER}
     -DCMAKE_ASM_COMPILER_ID=Clang)
 
-  # cmake requires CMAKE_LINKER to be specified if the compiler is MSVC-like,
+  # CMake requires CMAKE_LINKER to be specified if the compiler is MSVC-like,
   # otherwise it defaults the linker to be link.exe.
   if(BOOTSTRAP_LLVM_ENABLE_LLD)
     if((WIN32 AND NOT BOOTSTRAP_CMAKE_SYSTEM_NAME) OR BOOTSTRAP_CMAKE_SYSTEM_NAME STREQUAL "Windows")
@@ -792,7 +799,7 @@
   if(LLVM_BUILD_INSTRUMENTED)
     add_dependencies(clang-bootstrap-deps generate-profdata)
     set(PGO_OPT -DLLVM_PROFDATA_FILE=${CMAKE_CURRENT_BINARY_DIR}/utils/perf-training/clang.profdata)
-    # Use the current tools for LTO instead of the instrumented ones
+    # Use the current tools for LTO instead of the instrumented ones.
     list(APPEND _BOOTSTRAP_DEFAULT_PASSTHROUGH
       CMAKE_CXX_COMPILER
       CMAKE_C_COMPILER
@@ -846,7 +853,7 @@
     EXCLUDE_FROM_ALL 1
     CMAKE_ARGS
                 # We shouldn't need to set this here, but INSTALL_DIR doesn't
-                # seem to work, so instead I'm passing this through
+                # seem to work, so instead I'm passing this through.
                 -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
                 ${PASSTHROUGH_VARIABLES}
                 ${CLANG_BOOTSTRAP_CMAKE_ARGS}
@@ -865,17 +872,15 @@
     USES_TERMINAL_CONFIGURE 1
     USES_TERMINAL_BUILD 1
     USES_TERMINAL_INSTALL 1
-    LIST_SEPARATOR |
-    )
+    LIST_SEPARATOR |)
 
-  # exclude really-install from main target
+  # Exclude really-install from main target.
   set_target_properties(${NEXT_CLANG_STAGE} PROPERTIES _EP_really-install_EXCLUDE_FROM_MAIN On)
   ExternalProject_Add_Step(${NEXT_CLANG_STAGE} really-install
     COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --target install
-    COMMENT "Performing install step for '${NEXT_CLANG_STAGE}'"
+    COMMENT "Performing install step for '${NEXT_CLANG_STAGE}'..."
     DEPENDEES build
-    USES_TERMINAL 1
-  )
+    USES_TERMINAL 1)
   ExternalProject_Add_StepTargets(${NEXT_CLANG_STAGE} really-install)
   add_custom_target(${NEXT_CLANG_STAGE}-install DEPENDS ${NEXT_CLANG_STAGE}-really-install)
 
@@ -897,12 +902,11 @@
 
     ExternalProject_Add_Step(${NEXT_CLANG_STAGE} ${target}
       COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --target ${target}
-      COMMENT "Performing ${target} for '${NEXT_CLANG_STAGE}'"
+      COMMENT "Performing ${target} for '${NEXT_CLANG_STAGE}'..."
       DEPENDEES configure
       ALWAYS ${step_always}
       EXCLUDE_FROM_MAIN ON
-      USES_TERMINAL 1
-    )
+      USES_TERMINAL 1)
 
     if(target MATCHES "^stage[0-9]*")
       add_custom_target(${target} DEPENDS ${NEXT_CLANG_STAGE}-${target})
@@ -912,7 +916,7 @@
   endforeach()
 endif()
 
-if (LLVM_ADD_NATIVE_VISUALIZERS_TO_SOLUTION)
+if(LLVM_ADD_NATIVE_VISUALIZERS_TO_SOLUTION)
   add_subdirectory(utils/ClangVisualizers)
 endif()
 add_subdirectory(utils/hmaptool)
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to