[PATCH] D113490: [NFC] Let Microsoft mangler accept GlobalDecl

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 22 08:03:47 PST 2021


rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm



================
Comment at: clang/lib/AST/MicrosoftMangle.cpp:47
+  if (auto *CD = dyn_cast<CXXConstructorDecl>(DC))
+    GD = GlobalDecl(CD, Ctor_Complete);
+  else if (auto *DD = dyn_cast<CXXDestructorDecl>(DC))
----------------
yaxunl wrote:
> rnk wrote:
> > I would prefer if you passed Ctor_Base and Dtor_Base here. I believe MSVC models the variants as separate compiler-generated functions. I believe the user code is always emitted into the "base" variant. That's consistent with what the user can observe in `__FUNCDNAME__`, see here:
> > https://github.com/llvm/llvm-project/blob/main/clang/lib/AST/Expr.cpp#L635
> It seems Microsoft C++ ABI does not have ctor variants (https://github.com/llvm/llvm-project/blob/b2a2c38349a18b89b04d342632d5ea02f86dfdd6/clang/lib/CodeGen/CGClass.cpp#L1298). Clang currently assumes Ctor_Complete in such situation (https://github.com/llvm/llvm-project/blob/b2a2c38349a18b89b04d342632d5ea02f86dfdd6/clang/lib/CodeGen/CodeGenModule.cpp#L1356).
Hah, you're right, I forgot.


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

https://reviews.llvm.org/D113490



More information about the cfe-commits mailing list