[PATCH] Start adding support for dllimport/dllexport on classes (PR11170)
Hans Wennborg
hans at chromium.org
Tue May 27 19:19:56 PDT 2014
================
Comment at: lib/CodeGen/CodeGenModule.cpp:1395
@@ +1394,3 @@
+ // Don't dllexport/import destructor thunks.
+ F->setDLLStorageClass(llvm::GlobalValue::DefaultStorageClass);
+ }
----------------
Richard Smith wrote:
> This would make more sense to me in `SetFunctionAttributes`, where (presumably) the DLL storage class is set.
I broke the dtor thunk related changes out into r209706.
================
Comment at: lib/Sema/SemaDeclCXX.cpp:4394
@@ +4393,3 @@
+ // template specialization bases.
+ for (Decl *D : Class->decls()) {
+ if (VarDecl *VD = dyn_cast<VarDecl>(D)) {
----------------
Richard Smith wrote:
> What about member classes? Are they implicitly re-exported too?
Nope.
================
Comment at: lib/Sema/SemaDeclCXX.cpp:4404
@@ +4403,3 @@
+
+ if (ClassExported && !MD->isDefaulted() && !MD->isDeleted()) {
+ // Instantiate non-default methods.
----------------
Richard Smith wrote:
> `ClassExported && MD->isUserProvided()` maybe
Yes, that sounds good.
================
Comment at: lib/Sema/SemaDeclCXX.cpp:4407-4408
@@ +4406,4 @@
+ S.MarkFunctionReferenced(Class->getLocation(), MD);
+ } else if (ClassExported && !MD->isDeleted() &&
+ (!MD->isTrivial() || MD->isCopyAssignmentOperator())) {
+ // Also instantiate non-trivial default methods and the copy assignment
----------------
Richard Smith wrote:
> Weird! You get an exported trivial copy assignment but not an exported trivial copy constructor? I guess we'll need to update this once we find out what they do with implicit move operations?
Yes. I have no idea why they always export that copy assignment operator, but they do.
================
Comment at: lib/Sema/SemaDeclCXX.cpp:4415
@@ +4414,3 @@
+ S.ResolveExceptionSpec(Class->getLocation(), FPT);
+ S.ActOnFinishInlineMethodDef(MD);
+ }
----------------
Richard Smith wrote:
> Why do we need this here but not in the non-defaulted case?
I don't remember exactly, but I never ran into trouble with the non-default methods.
http://reviews.llvm.org/D3877
More information about the cfe-commits
mailing list