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

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 22 06:23:35 PST 2021


yaxunl marked 2 inline comments as done.
yaxunl added inline comments.


================
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))
----------------
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).


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

https://reviews.llvm.org/D113490



More information about the cfe-commits mailing list