[libc-commits] [libc] [libc] Remove recursion in get_object_files_for_test to improve build time. (PR #72351)

Guillaume Chatelet via libc-commits libc-commits at lists.llvm.org
Thu Nov 16 01:04:06 PST 2023


================
@@ -15,48 +15,60 @@
 function(get_object_files_for_test result skipped_entrypoints_list)
   set(object_files "")
   set(skipped_list "")
-  foreach(dep IN LISTS ARGN)
-    if (NOT TARGET ${dep})
-      # Skip any tests whose dependencies have not been defined.
-      list(APPEND skipped_list ${dep})
-      continue()
-    endif()
-    get_target_property(dep_type ${dep} "TARGET_TYPE")
-    if(NOT dep_type)
-      # Target for which TARGET_TYPE property is not set do not
-      # provide any object files.
-      continue()
-    endif()
+  set(checked_list "")
+  set(unchecked_list "${ARGN}")
+  list(REMOVE_DUPLICATES unchecked_list)
+  list(LENGTH unchecked_list length)
 
-    if(${dep_type} STREQUAL ${OBJECT_LIBRARY_TARGET_TYPE})
-      get_target_property(dep_object_files ${dep} "OBJECT_FILES")
-      if(dep_object_files)
-        list(APPEND object_files ${dep_object_files})
-      endif()
-    elseif(${dep_type} STREQUAL ${ENTRYPOINT_OBJ_TARGET_TYPE})
-      get_target_property(is_skipped ${dep} "SKIPPED")
-      if(is_skipped)
+  while(length)
+    set(indirect_list "")
+
+    foreach(dep IN LISTS unchecked_list)
+      if (NOT TARGET ${dep})
+        # Skip any tests whose dependencies have not been defined.
----------------
gchatelet wrote:

[nit] Skip tests with no dependencies.

https://github.com/llvm/llvm-project/pull/72351


More information about the libc-commits mailing list