[clang] [CIR] Add Support for linking bitcode modules on cc1 (PR #196245)

David Rivera via cfe-commits cfe-commits at lists.llvm.org
Fri May 22 09:03:46 PDT 2026


================
@@ -173,6 +189,31 @@ class CIRGenConsumer : public clang::ASTConsumer {
     }
   }
 
+  bool linkInModules(llvm::Module &M) {
----------------
RiverDave wrote:

Did some digging on the diagnostics:

OG installs a handler on the LLVMContext that routes LLVM side diagnostics into clang's DiagnosticsEngine, which seems to be used for the whole post codegen pipeline, not just linking. There's also a small cursor written by the link loop and read by the handler, so linker diagnostics get attributed to the specific bitcode file.

CIR doesn't install either yet, so right now, LLVM-side diagnostics fall through to the default path. I think this is fine for the success case (how I noticed the link path was missing), degraded otherwise.  I was thinking it'd be better if we handled this incrementally. I can track this in an issue or something, so we don't forget.

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


More information about the cfe-commits mailing list