[compiler-rt] r246102 - [CMake] Converting add_sanitizer_rt_symbols to use cmake_parse_arguments.

Chris Bieneman via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 26 16:12:26 PDT 2015


Author: cbieneman
Date: Wed Aug 26 18:12:25 2015
New Revision: 246102

URL: http://llvm.org/viewvc/llvm-project?rev=246102&view=rev
Log:
[CMake] Converting add_sanitizer_rt_symbols to use cmake_parse_arguments.

Summary: This is the first step in a multi-step refactoring to move add_sanitizer_rt_symbols in the direction of other add_* functions in compiler-rt.

Reviewers: filcab, bogner, kubabrecka, zaks.anna, glider, samsonov

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D12386

Modified:
    compiler-rt/trunk/cmake/Modules/SanitizerUtils.cmake
    compiler-rt/trunk/lib/asan/CMakeLists.txt
    compiler-rt/trunk/lib/dfsan/CMakeLists.txt
    compiler-rt/trunk/lib/msan/CMakeLists.txt
    compiler-rt/trunk/lib/tsan/CMakeLists.txt
    compiler-rt/trunk/lib/ubsan/CMakeLists.txt

Modified: compiler-rt/trunk/cmake/Modules/SanitizerUtils.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/SanitizerUtils.cmake?rev=246102&r1=246101&r2=246102&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/SanitizerUtils.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/SanitizerUtils.cmake Wed Aug 26 18:12:25 2015
@@ -8,11 +8,17 @@ set(SANITIZER_LINT_SCRIPT
 # that need to be exported from sanitizer runtime "<name>". Function
 # interceptors are exported automatically, user can also provide files with
 # symbol names that should be exported as well.
-#   add_sanitizer_rt_symbols(<name> <files with extra symbols to export>)
+#   add_sanitizer_rt_symbols(<name>
+#                            EXTRA <files with extra symbols to export>)
 macro(add_sanitizer_rt_symbols name)
+  cmake_parse_arguments(ARG
+    ""
+    ""
+    "EXTRA"
+    ${ARGN})
   set(stamp ${CMAKE_CURRENT_BINARY_DIR}/${name}.syms-stamp)
   set(extra_args)
-  foreach(arg ${ARGN})
+  foreach(arg ${ARG_EXTRA})
     list(APPEND extra_args "--extra" ${arg})
   endforeach()
   add_custom_command(OUTPUT ${stamp}
@@ -20,13 +26,13 @@ macro(add_sanitizer_rt_symbols name)
       ${SANITIZER_GEN_DYNAMIC_LIST} ${extra_args} $<TARGET_FILE:${name}>
       > $<TARGET_FILE:${name}>.syms
     COMMAND ${CMAKE_COMMAND} -E touch ${stamp}
-    DEPENDS ${name} ${SANITIZER_GEN_DYNAMIC_LIST} ${ARGN}
+    DEPENDS ${name} ${SANITIZER_GEN_DYNAMIC_LIST} ${ARG_EXTRA}
     WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
     COMMENT "Generating exported symbols for ${name}"
     VERBATIM)
   add_custom_target(${name}-symbols ALL
     DEPENDS ${stamp}
-    SOURCES ${SANITIZER_GEN_DYNAMIC_LIST} ${ARGN})
+    SOURCES ${SANITIZER_GEN_DYNAMIC_LIST} ${ARG_EXTRA})
 
   if(NOT CMAKE_VERSION VERSION_LESS 3.0)
     install(FILES $<TARGET_FILE:${name}>.syms

Modified: compiler-rt/trunk/lib/asan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/CMakeLists.txt?rev=246102&r1=246101&r2=246102&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/asan/CMakeLists.txt Wed Aug 26 18:12:25 2015
@@ -191,7 +191,8 @@ else()
     if (UNIX AND NOT ${arch} MATCHES "i386|i686")
       add_sanitizer_rt_symbols(clang_rt.asan_cxx-${arch})
       add_dependencies(asan clang_rt.asan_cxx-${arch}-symbols)
-      add_sanitizer_rt_symbols(clang_rt.asan-${arch} asan.syms.extra)
+      add_sanitizer_rt_symbols(clang_rt.asan-${arch} 
+        EXTRA asan.syms.extra)
       add_dependencies(asan clang_rt.asan-${arch}-symbols)
     endif()
 

Modified: compiler-rt/trunk/lib/dfsan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/dfsan/CMakeLists.txt?rev=246102&r1=246101&r2=246102&view=diff
==============================================================================
--- compiler-rt/trunk/lib/dfsan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/dfsan/CMakeLists.txt Wed Aug 26 18:12:25 2015
@@ -24,7 +24,8 @@ foreach(arch ${DFSAN_SUPPORTED_ARCH})
             $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
     CFLAGS ${DFSAN_CFLAGS}
     PARENT_TARGET dfsan)
-  add_sanitizer_rt_symbols(clang_rt.dfsan-${arch} dfsan.syms.extra)
+  add_sanitizer_rt_symbols(clang_rt.dfsan-${arch}
+    EXTRA dfsan.syms.extra)
   add_dependencies(dfsan
     clang_rt.dfsan-${arch}-symbols)
 endforeach()

Modified: compiler-rt/trunk/lib/msan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/CMakeLists.txt?rev=246102&r1=246101&r2=246102&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/msan/CMakeLists.txt Wed Aug 26 18:12:25 2015
@@ -47,8 +47,10 @@ foreach(arch ${MSAN_SUPPORTED_ARCH})
   list(APPEND MSAN_RUNTIME_LIBRARIES clang_rt.msan-${arch}
                                      clang_rt.msan_cxx-${arch})
   if(UNIX)
-    add_sanitizer_rt_symbols(clang_rt.msan-${arch} msan.syms.extra)
-    add_sanitizer_rt_symbols(clang_rt.msan_cxx-${arch} msan.syms.extra)
+    add_sanitizer_rt_symbols(clang_rt.msan-${arch}
+      EXTRA msan.syms.extra)
+    add_sanitizer_rt_symbols(clang_rt.msan_cxx-${arch}
+      EXTRA msan.syms.extra)
     add_dependencies(msan clang_rt.msan-${arch}-symbols
                           clang_rt.msan_cxx-${arch}-symbols)
   endif()

Modified: compiler-rt/trunk/lib/tsan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/CMakeLists.txt?rev=246102&r1=246101&r2=246102&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/tsan/CMakeLists.txt Wed Aug 26 18:12:25 2015
@@ -118,8 +118,10 @@ foreach(arch ${TSAN_SUPPORTED_ARCH})
     CFLAGS ${TSAN_RTL_CFLAGS})
   list(APPEND TSAN_RUNTIME_LIBRARIES clang_rt.tsan-${arch}
                                      clang_rt.tsan_cxx-${arch})
-  add_sanitizer_rt_symbols(clang_rt.tsan-${arch} rtl/tsan.syms.extra)
-  add_sanitizer_rt_symbols(clang_rt.tsan_cxx-${arch} rtl/tsan.syms.extra)
+  add_sanitizer_rt_symbols(clang_rt.tsan-${arch}
+    EXTRA rtl/tsan.syms.extra)
+  add_sanitizer_rt_symbols(clang_rt.tsan_cxx-${arch}
+    EXTRA rtl/tsan.syms.extra)
   add_dependencies(tsan clang_rt.tsan-${arch}
                         clang_rt.tsan_cxx-${arch}
                         clang_rt.tsan-${arch}-symbols

Modified: compiler-rt/trunk/lib/ubsan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/CMakeLists.txt?rev=246102&r1=246101&r2=246102&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ubsan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/ubsan/CMakeLists.txt Wed Aug 26 18:12:25 2015
@@ -96,8 +96,10 @@ else()
 
     foreach(arch ${UBSAN_SUPPORTED_ARCH})
       if (UNIX AND NOT ${arch} MATCHES "i386|i686")
-        add_sanitizer_rt_symbols(clang_rt.ubsan_standalone-${arch} ubsan.syms.extra)
-        add_sanitizer_rt_symbols(clang_rt.ubsan_standalone_cxx-${arch} ubsan.syms.extra)
+        add_sanitizer_rt_symbols(clang_rt.ubsan_standalone-${arch}
+          EXTRA ubsan.syms.extra)
+        add_sanitizer_rt_symbols(clang_rt.ubsan_standalone_cxx-${arch}
+          EXTRA ubsan.syms.extra)
         add_dependencies(ubsan
           clang_rt.ubsan_standalone-${arch}-symbols
           clang_rt.ubsan_standalone_cxx-${arch}-symbols)




More information about the llvm-commits mailing list