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

Shrisha Kumar via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 25 23:18:29 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();
----------------
Shrisha4real wrote:

Valid. I have changed the name from `module` to `mod` . 

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


More information about the cfe-commits mailing list