[libclc] [libclc] Don't add --override if there is no bitcode of generic implementation (PR #157603)

Wenju He via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 11 01:16:52 PDT 2025


================
@@ -92,7 +92,8 @@ function(link_bc)
     ${ARGN}
   )
 
-  if( ARG_INTERNALIZE )
+  string( FIND "${ARG_INPUTS}" "/generic/" has_generic )
+  if( ARG_INTERNALIZE OR has_generic LESS 0 )
----------------
wenju-he wrote:

> Can this actually be negative? Or equal 0?

if "/generic/" is found, has_generic is greater or equal to 0, which is the 0-based index of the first occurrence. Otherwise, has_generic is equal to -1, meaning pattern is not found.

The above Copilot AI analysis is not correct. The newly added check is to make sure "--override" is not appended to each non-generic bitcode if there is not a single generic bitcode in ARG_INPUTS and in this case has_generic at line 96 is -1.
In contrary, at line 103 - 106, it is trying to add "--override" to non-generic bitcodes so it expects that has_generic at line 104 is -1.

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


More information about the cfe-commits mailing list