[clang] [llvm] [HLSL] Set visibility of cbuffer global variables to internal (PR #200312)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 9 03:48:49 PDT 2026


================
@@ -71,6 +72,22 @@ CBufferMetadata::get(Module &M, llvm::function_ref<bool(Type *)> IsPadding) {
   return Result;
 }
 
+void CBufferMetadata::removeCBufferGlobalsFromUseList(Module &M) {
+
+  SmallPtrSet<GlobalVariable *, 8> CBGlobals;
+  for (const hlsl::CBufferMapping &Mapping : Mappings)
+    CBGlobals.insert(Mapping.Handle);
+
+  llvm::removeFromUsedLists(M, [&](Constant *C) -> bool {
----------------
mahesh-attarde wrote:

Hi @hekota , ` llvm::removeFromUsedLists` use here breaks shared library build due to undefined reference.
Since mostly llvm builds care about static archive, locally I have to use shared lib.
Problem adding dependency is it creates cyclic dependency error. Have you encountered such problem?



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


More information about the cfe-commits mailing list