[compiler-rt] r248720 - [CMake] [Darwin] Make darwin_filter_builtin_sources support both whitelist and blacklist filtering.

Chris Bieneman via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 10:38:44 PDT 2015


Author: cbieneman
Date: Mon Sep 28 12:38:44 2015
New Revision: 248720

URL: http://llvm.org/viewvc/llvm-project?rev=248720&view=rev
Log:
[CMake] [Darwin] Make darwin_filter_builtin_sources support both whitelist and blacklist filtering.

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

Modified: compiler-rt/trunk/cmake/Modules/CompilerRTDarwinUtils.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/CompilerRTDarwinUtils.cmake?rev=248720&r1=248719&r2=248720&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/CompilerRTDarwinUtils.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/CompilerRTDarwinUtils.cmake Mon Sep 28 12:38:44 2015
@@ -204,12 +204,22 @@ endfunction()
 # Filter out generic versions of routines that are re-implemented in
 # architecture specific manner.  This prevents multiple definitions of the
 # same symbols, making the symbol selection non-deterministic.
-function(darwin_filter_builtin_sources output_var excluded_list)
+function(darwin_filter_builtin_sources output_var exclude_or_include excluded_list)
+  if(exclude_or_include STREQUAL "EXCLUDE")
+    set(filter_action GREATER)
+    set(filter_value -1)
+  elseif(exclude_or_include STREQUAL "INCLUDE")
+    set(filter_action LESS)
+    set(filter_value 0)
+  else()
+    message(FATAL_ERROR "darwin_filter_builtin_sources called without EXCLUDE|INCLUDE")
+  endif()
+
   set(intermediate ${ARGN})
   foreach (_file ${intermediate})
     get_filename_component(_name_we ${_file} NAME_WE)
     list(FIND ${excluded_list} ${_name_we} _found)
-    if(_found GREATER -1)
+    if(_found ${filter_action} ${filter_value})
       list(REMOVE_ITEM intermediate ${_file})
     elseif(${_file} MATCHES ".*/.*\\.S")
       get_filename_component(_name ${_file} NAME)
@@ -256,7 +266,9 @@ macro(darwin_add_builtin_libraries)
                               ARCH ${arch}
                               MIN_VERSION ${DARWIN_${os}_BUILTIN_MIN_VER})
 
-      darwin_filter_builtin_sources(filtered_sources ${arch}_${os}_EXCLUDED_BUILTINS ${${arch}_SOURCES})
+      darwin_filter_builtin_sources(filtered_sources
+        EXCLUDE ${arch}_${os}_EXCLUDED_BUILTINS
+        ${${arch}_SOURCES})
 
       darwin_add_builtin_library(clang_rt builtins
                               OS ${os}




More information about the llvm-commits mailing list