================
@@ -104,19 +99,18 @@ void CIRGenModule::emitCXXGlobalVarDeclInitFunc(const 
VarDecl *vd,
                                                 bool performInit) {
   assert(!cir::MissingFeatures::cudaSupport());
 
-  assert(!cir::MissingFeatures::deferredCXXGlobalInit());
-
-  // TODO(cir): Classic codegen calls emitCXXGuardedInit in the following case:
-  // template<typename T> struct Templ {
-  //   static T f;
-  // };
-  // template<typename T> T Templ<T>::f = get_i();
-  // auto func() {
-  //   Templ<int> t;
-  //   return decltype(t)::f;
-  // }
-  //
-  // However, at the moment it is only suitable for static-local variables, so
-  // we will have to modify it to work for this case as well.
-  emitCXXGlobalVarDeclInit(vd, addr, performInit);
+  // Classic CodeGen dispatches guarded initialization through
+  // CGCXXABI::EmitGuardedInit, which the Microsoft ABI overrides with a
+  // completely different (bitmask-based "magic statics") guard scheme
+  // instead of the Itanium __cxa_guard_acquire/__cxa_guard_release calls
+  // that emitCXXGuardedInit/LoweringPrepare unconditionally assume here.
+  assert(!cir::MissingFeatures::msabi());
----------------
xakep8 wrote:

This will not emit an NYI diagnostic, MissingFeatures::msabi() currently always 
returns false, so the assertion always succeeds.

Could this rather check getTarget().getCXXABI().isMicrosoft(), emit errorNYI, 
and return. We should also add an MS-target regression test as well.

https://github.com/llvm/llvm-project/pull/228586
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to