[compiler-rt] r306453 - Loop directly over sanitizers to build in cmake

Francis Ricci via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 12:32:39 PDT 2017


Author: fjricci
Date: Tue Jun 27 12:32:39 2017
New Revision: 306453

URL: http://llvm.org/viewvc/llvm-project?rev=306453&view=rev
Log:
Loop directly over sanitizers to build in cmake

Summary: Cleaner than computing the intersection for each possible sanitizer

Reviewers: compnerd, beanz

Subscribers: llvm-commits, mgorny

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

Modified:
    compiler-rt/trunk/lib/CMakeLists.txt
    compiler-rt/trunk/test/CMakeLists.txt

Modified: compiler-rt/trunk/lib/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/CMakeLists.txt?rev=306453&r1=306452&r2=306453&view=diff
==============================================================================
--- compiler-rt/trunk/lib/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/CMakeLists.txt Tue Jun 27 12:32:39 2017
@@ -21,17 +21,6 @@ function(compiler_rt_build_runtime runti
   string(TOUPPER ${runtime} runtime_uppercase)
   if(COMPILER_RT_HAS_${runtime_uppercase})
     add_subdirectory(${runtime})
-    foreach(directory ${ARGN})
-      add_subdirectory(${directory})
-    endforeach()
-  endif()
-endfunction()
-
-function(compiler_rt_build_sanitizer sanitizer)
-  string(TOLOWER ${sanitizer} sanitizer_lowercase)
-  list(FIND COMPILER_RT_SANITIZERS_TO_BUILD ${sanitizer_lowercase} result)
-  if(NOT ${result} EQUAL -1)
-    compiler_rt_build_runtime(${sanitizer} ${ARGN})
   endif()
 endfunction()
 
@@ -44,14 +33,12 @@ if(COMPILER_RT_BUILD_SANITIZERS)
     add_subdirectory(ubsan)
   endif()
 
-  compiler_rt_build_sanitizer(asan)
-  compiler_rt_build_sanitizer(dfsan)
-  compiler_rt_build_sanitizer(msan)
-  compiler_rt_build_sanitizer(tsan tsan/dd)
-  compiler_rt_build_sanitizer(safestack)
-  compiler_rt_build_sanitizer(cfi)
-  compiler_rt_build_sanitizer(esan)
-  compiler_rt_build_sanitizer(scudo)
+  foreach(sanitizer ${COMPILER_RT_SANITIZERS_TO_BUILD})
+    compiler_rt_build_runtime(${sanitizer})
+    if(${sanitizer} STREQUAL tsan)
+      add_subdirectory(tsan/dd)
+    endif()
+  endforeach()
 
   compiler_rt_build_runtime(profile)
 endif()

Modified: compiler-rt/trunk/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/CMakeLists.txt?rev=306453&r1=306452&r2=306453&view=diff
==============================================================================
--- compiler-rt/trunk/test/CMakeLists.txt (original)
+++ compiler-rt/trunk/test/CMakeLists.txt Tue Jun 27 12:32:39 2017
@@ -45,14 +45,6 @@ function(compiler_rt_test_runtime runtim
   endif()
 endfunction()
 
-function(compiler_rt_test_sanitizer sanitizer)
-  string(TOLOWER ${sanitizer} sanitizer_lowercase)
-  list(FIND COMPILER_RT_SANITIZERS_TO_BUILD ${sanitizer_lowercase} result)
-  if(NOT ${result} EQUAL -1)
-    compiler_rt_test_runtime(${sanitizer} ${ARGN})
-  endif()
-endfunction()
-
 # Run sanitizer tests only if we're sure that clang would produce
 # working binaries.
 if(COMPILER_RT_CAN_EXECUTE_TESTS)
@@ -67,13 +59,9 @@ if(COMPILER_RT_CAN_EXECUTE_TESTS)
     compiler_rt_test_runtime(ubsan cfi)
     compiler_rt_test_runtime(sanitizer_common)
 
-    compiler_rt_test_sanitizer(asan)
-    compiler_rt_test_sanitizer(dfsan)
-    compiler_rt_test_sanitizer(msan)
-    compiler_rt_test_sanitizer(tsan)
-    compiler_rt_test_sanitizer(safestack)
-    compiler_rt_test_sanitizer(esan)
-    compiler_rt_test_sanitizer(scudo)
+    foreach(sanitizer ${COMPILER_RT_SANITIZERS_TO_BUILD})
+      compiler_rt_test_runtime(${sanitizer})
+    endforeach()
 
     compiler_rt_test_runtime(profile)
   endif()




More information about the llvm-commits mailing list