[llvm-branch-commits] [clang] [CIR] Add CIRGen support for static local variables with non-constant initializers (PR #179827)

Bruno Cardoso Lopes via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Feb 12 15:51:09 PST 2026


================
@@ -10,13 +10,31 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "CIRGenFunction.h"
 #include "CIRGenModule.h"
 #include "clang/AST/Attr.h"
 #include "clang/Basic/LangOptions.h"
 
 using namespace clang;
 using namespace clang::CIRGen;
 
+void CIRGenFunction::emitCXXGuardedInit(const VarDecl &varDecl,
+                                        cir::GlobalOp globalOp,
+                                        bool performInit) {
+  // If we've been asked to forbid guard variables, emit an error now.
+  // This diagnostic is hard-coded for Darwin's use case; we can find
+  // better phrasing if someone else needs it.
+  if (cgm.getCodeGenOpts().ForbidGuardVariables)
+    cgm.errorNYI(varDecl.getLocation(), "guard variables are forbidden");
----------------
bcardosolopes wrote:

Fixed

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


More information about the llvm-branch-commits mailing list