[clang] [CIR] Avoid GetGVALinkageForFunction on function declarations (PR #198422)

via cfe-commits cfe-commits at lists.llvm.org
Wed May 27 09:08:18 PDT 2026


adams381 wrote:

After looking at this more carefully: #195257 does overlap. It removed the `getFunctionLinkage` call from `setFunctionAttributes` that was causing the crash, so the original crash fix is already in upstream.

What remains independently needed is the `setLinkageForFunction` addition — classic CodeGen's `SetFunctionAttributes` calls `setLinkageForGV` to force `ExternalWeakLinkage` on `__attribute__((weak))` and `weak_import` declarations, and CIR had no equivalent for functions. The visibility block I re-added (with the same TODO you removed in #195257) is redundant since `setGVProperties` → `setGlobalVisibility` already covers that path. I'll drop it and update the description to reflect the narrower scope.

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


More information about the cfe-commits mailing list