[libc-commits] [libc] [libc] Improve get_object_files_for_test to reduce CMake configure time for tests. (PR #75552)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Fri Dec 15 00:21:47 PST 2023


================
@@ -18,62 +18,80 @@ function(get_object_files_for_test result skipped_entrypoints_list)
   set(checked_list "")
   set(unchecked_list "${ARGN}")
   list(REMOVE_DUPLICATES unchecked_list)
-  list(LENGTH unchecked_list length)
 
-  while(length)
-    set(indirect_list "")
+  foreach(dep IN LISTS unchecked_list)
+    if (NOT TARGET ${dep})
+      # Skip tests with undefined dependencies.
+      list(APPEND skipped_list ${dep})
+      continue()
+    endif()
+    get_target_property(aliased_target ${dep} "ALIASED_TARGET")
+    if(aliased_target)
+      # If the target is just an alias, switch to the real target.
+      set(dep ${aliased_target})
+    endif()
 
-    foreach(dep IN LISTS unchecked_list)
-      if (NOT TARGET ${dep})
-        # Skip tests with undefined dependencies.
-        list(APPEND skipped_list ${dep})
-        continue()
-      endif()
-      get_target_property(dep_type ${dep} "TARGET_TYPE")
-      if(NOT dep_type)
-        # Skip tests with no object dependencies.
-        continue()
-      endif()
+    get_target_property(dep_type ${dep} "TARGET_TYPE")
+    if(NOT dep_type)
+      # Skip tests with no object dependencies.
+      continue()
+    endif()
+
+    get_target_property(dep_obj ${dep} "OBJECT_FILES_FOR_TESTS")
+    get_target_property(dep_skip ${dep} "SKIPPED_LIST_FOR_TESTS")
----------------
nickdesaulniers wrote:

these get discarded in the `else` clause.  Could you sink these gets into the `if` clause below?

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


More information about the libc-commits mailing list