[clang] [CIR][OpenMP] Implement codegen for OpenMP `critical` directive in ClangIR (PR #240414)

Steffen Larsen via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 24 03:41:53 PST 2026


================
@@ -209,10 +209,85 @@ CIRGenFunction::emitOMPMasterDirective(const OMPMasterDirective &s) {
   getCIRGenModule().errorNYI(s.getSourceRange(), "OpenMP OMPMasterDirective");
   return mlir::failure();
 }
+
+/// Find or create the module-level declaration of the critical section \p name.
+/// Returns null, after emitting an error, if the name is already used by
+/// another symbol or the hint cannot be represented.
+static mlir::omp::CriticalDeclareOp
+getOrCreateCriticalDeclare(CIRGenFunction &cgf, const OMPCriticalDirective &s,
+                           llvm::StringRef name, mlir::Location loc) {
+  CIRGenModule &cgm = cgf.getCIRGenModule();
+  mlir::ModuleOp module = cgm.getModule();
----------------
steffenlarsen wrote:

I know it's the norm around the code, but I will keep flagging it: The name `module` is probably going to be problematic in the future as it will become a keyword.

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


More information about the cfe-commits mailing list