[PATCH] D137107: Allow MS extension: support of constexpr with __declspec(dllimport).

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 19 10:54:10 PST 2022


efriedma added inline comments.


================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:4761
+  return Opts.CPlusPlus && D->hasConstantInitialization() &&
+         D->getType()->isRecordType();
+}
----------------
Not sure what the `D->getType()->isRecordType()` check is doing here.


================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:4852
+          if (!CD->isTrivial() && !D->getTLSKind())
+            NeedsGlobalCtor = true;
+        }
----------------
I have no idea what this code is supposed to do.


================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:5009
+  if (isStaticInit(D, getLangOpts()) && NeedsGlobalCtor && NeedsGlobalDtor) {
+    EmitCXXCtorInit(D, GV, true, 201, llvm::StringLiteral("ctor"), false);
+    EmitCXXCtorInit(D, GV, false, 65535, llvm::StringLiteral("dtor"), true);
----------------
I think you want to use priority 201 whether or not there's a destructor.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137107/new/

https://reviews.llvm.org/D137107



More information about the cfe-commits mailing list