[compiler-rt] r311733 - Add Clang dependency to the check for Clang C++ headers.

George Karpenkov via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 24 16:43:17 PDT 2017


Author: george.karpenkov
Date: Thu Aug 24 16:43:17 2017
New Revision: 311733

URL: http://llvm.org/viewvc/llvm-project?rev=311733&view=rev
Log:
Add Clang dependency to the check for Clang C++ headers.

The problem is that CMake is mostly imperative and the result of
processing "if (TARGET blah)" checks depends on the order of import of
CMake files.
In this case, "projects" folder is registered before "tools",
and calling "CheckClangHeaders" [renamed to have a better name]
errors out without even giving Clang a chance to be built.

This, in turn, leads to libFuzzer bot failures in some circumstances on
some machines (depends on whether LIT or UNIT tests are scheduled
first).

Differential Revision: https://reviews.llvm.org/D37126

Modified:
    compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake

Modified: compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake?rev=311733&r1=311732&r2=311733&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake Thu Aug 24 16:43:17 2017
@@ -67,8 +67,8 @@ function(clang_compile object_file sourc
   if(NOT COMPILER_RT_STANDALONE_BUILD)
     list(APPEND SOURCE_DEPS clang compiler-rt-headers)
   endif()
-  if (TARGET CompilerRTUnitTestCheckCxx)
-    list(APPEND SOURCE_DEPS CompilerRTUnitTestCheckCxx)
+  if (TARGET CheckClangHeaders)
+    list(APPEND SOURCE_DEPS CheckClangHeaders)
   endif()
   string(REGEX MATCH "[.](cc|cpp)$" is_cxx ${source_rpath})
   string(REGEX MATCH "[.](m|mm)$" is_objc ${source_rpath})
@@ -132,12 +132,10 @@ macro(clang_compiler_add_cxx_check)
       "  false"
       "fi"
       )
-    add_custom_target(CompilerRTUnitTestCheckCxx
+    add_custom_target(CheckClangHeaders
       COMMAND bash -c "${CMD}"
       COMMENT "Checking that just-built clang can find C++ headers..."
       VERBATIM)
-    if (TARGET clang)
-      ADD_DEPENDENCIES(CompilerRTUnitTestCheckCxx clang)
-    endif()
+    ADD_DEPENDENCIES(CheckClangHeaders clang)
   endif()
 endmacro()




More information about the llvm-commits mailing list