[llvm] r330158 - build: reserve `--color-diagnostics` for lld

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 16 14:05:56 PDT 2018


Author: compnerd
Date: Mon Apr 16 14:05:56 2018
New Revision: 330158

URL: http://llvm.org/viewvc/llvm-project?rev=330158&view=rev
Log:
build: reserve `--color-diagnostics` for lld

When building out-of-tree compilers (e.g. swift), the linker check here
may yield incorrect values.  Ensure that we are using lld before we
attempt to use `--color-diagnostics` for the linker.  Other linkers (i.e
bfd, gold) do not support this flag and the test can pass in some cases
and then fail subsequently when building.

Modified:
    llvm/trunk/cmake/modules/HandleLLVMOptions.cmake

Modified: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMOptions.cmake?rev=330158&r1=330157&r2=330158&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake (original)
+++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Mon Apr 16 14:05:56 2018
@@ -728,7 +728,7 @@ if (UNIX AND
 endif()
 
 # lld doesn't print colored diagnostics when invoked from Ninja
-if (UNIX AND CMAKE_GENERATOR STREQUAL "Ninja")
+if (UNIX AND CMAKE_LINKER MATCHES lld AND CMAKE_GENERATOR STREQUAL "Ninja")
   include(CheckLinkerFlag)
   check_linker_flag("-Wl,--color-diagnostics" LINKER_SUPPORTS_COLOR_DIAGNOSTICS)
   append_if(LINKER_SUPPORTS_COLOR_DIAGNOSTICS "-Wl,--color-diagnostics"




More information about the llvm-commits mailing list