[PATCH] D108021: [dllexport] Instantiate default ctor default args
Reid Kleckner via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 23 16:02:41 PDT 2021
This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe42ce422a978: [dllexport] Instantiate default ctor default args (authored by rnk).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D108021/new/
https://reviews.llvm.org/D108021
Files:
clang/lib/Sema/SemaDeclCXX.cpp
clang/test/CodeGenCXX/dllexport-ctor-closure-nested.cpp
Index: clang/test/CodeGenCXX/dllexport-ctor-closure-nested.cpp
===================================================================
--- /dev/null
+++ clang/test/CodeGenCXX/dllexport-ctor-closure-nested.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -triple i686-windows-msvc -emit-llvm -std=c++14 \
+// RUN: -fno-threadsafe-statics -fms-extensions -O1 -mconstructor-aliases \
+// RUN: -disable-llvm-passes -o - %s -w -fms-compatibility-version=19.00 | \
+// RUN: FileCheck %s
+
+struct HasDtor {
+ ~HasDtor();
+ int o;
+};
+struct HasImplicitDtor1 {
+ HasDtor o;
+};
+struct __declspec(dllexport) CtorClosureOuter {
+ struct __declspec(dllexport) CtorClosureInner {
+ CtorClosureInner(const HasImplicitDtor1 &v = {}) {}
+ };
+};
+
+// CHECK-LABEL: $"??1HasImplicitDtor1@@QAE at XZ" = comdat any
+// CHECK-LABEL: define weak_odr dso_local dllexport x86_thiscallcc void @"??_FCtorClosureInner at CtorClosureOuter@@QAEXXZ"({{.*}}) {{#[0-9]+}} comdat
Index: clang/lib/Sema/SemaDeclCXX.cpp
===================================================================
--- clang/lib/Sema/SemaDeclCXX.cpp
+++ clang/lib/Sema/SemaDeclCXX.cpp
@@ -6005,6 +6005,15 @@
if (TSK == TSK_ImplicitInstantiation && !ClassAttr->isInherited())
continue;
+ // If this is an MS ABI dllexport default constructor, instantiate any
+ // default arguments.
+ if (S.Context.getTargetInfo().getCXXABI().isMicrosoft()) {
+ auto *CD = dyn_cast<CXXConstructorDecl>(MD);
+ if (CD && CD->isDefaultConstructor() && TSK == TSK_Undeclared) {
+ S.InstantiateDefaultCtorDefaultArgs(CD);
+ }
+ }
+
S.MarkFunctionReferenced(Class->getLocation(), MD);
// The function will be passed to the consumer when its definition is
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108021.368232.patch
Type: text/x-patch
Size: 1758 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210823/886bc932/attachment.bin>
More information about the cfe-commits
mailing list