[PATCH] MS ABI: Generate default constructor closures

Reid Kleckner rnk at google.com
Fri Mar 13 15:27:26 PDT 2015


lgtm


================
Comment at: lib/CodeGen/MicrosoftCXXABI.cpp:1073-1077
@@ +1072,7 @@
+  if (D->hasAttr<DLLExportAttr>() && D->isDefaultConstructor()) {
+    CallingConv ExpectedCallingConv = getContext().getDefaultCallingConvention(
+        /*IsVariadic=*/false, /*IsCXXMethod=*/true);
+    CallingConv ActualCallingConv =
+        D->getType()->getAs<FunctionProtoType>()->getCallConv();
+    if (ExpectedCallingConv != ActualCallingConv || D->getNumParams() != 0) {
+      llvm::Function *Fn = getAddrOfCXXCtorClosure(D, Ctor_DefaultClosure);
----------------
Can we wrap up the calling convention comparison test into a helper with a name like `hasDefaultCXXMethodCC()`?

================
Comment at: lib/Sema/SemaDecl.cpp:12088
@@ +12087,3 @@
+        Context.getTargetInfo().getCXXABI().isMicrosoft()) {
+      for (Decl *Member : Class->decls()) {
+        auto *CD = dyn_cast<CXXConstructorDecl>(Member);
----------------
Let's pull this loop out into a static helper.

http://reviews.llvm.org/D8331

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list