[PATCH] Start adding support for dllimport/dllexport on classes (PR11170)
Hans Wennborg
hans at chromium.org
Fri May 30 10:05:45 PDT 2014
Thanks everyone for the review!
================
Comment at: lib/CodeGen/CGVTables.cpp:663
@@ +662,3 @@
+ } else if (RD->hasAttr<DLLImportAttr>()) {
+ // Imported functions are available externally.
+ DiscardableODRLinkage = llvm::GlobalVariable::AvailableExternallyLinkage;
----------------
Reid Kleckner wrote:
> "Imported vtables"
Done.
================
Comment at: lib/CodeGen/MicrosoftCXXABI.cpp:920
@@ +919,3 @@
+
+ if (RD->hasAttr<DLLImportAttr>())
+ VTable->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass);
----------------
Reid Kleckner wrote:
> This should probably also go in getAddrOfVTable. I wonder if that explains the MinGW issue.
Done.
I guess for MinGW we'd need to add it to the Itanium ABI's getAddrOfVTable.
================
Comment at: lib/CodeGen/MicrosoftCXXABI.cpp:1230
@@ -1220,1 +1229,3 @@
+ if (RD->hasAttr<DLLImportAttr>())
+ GV->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass);
----------------
Reid Kleckner wrote:
> This should be in getAddrOfVBTable. We might want to avoid emitting available externally vbtables at -O0 and simply import them from the dll.
Done.
================
Comment at: lib/Sema/SemaDeclCXX.cpp:4385
@@ +4384,3 @@
+ NewAttr->setInherited(true);
+ Member->addAttr(NewAttr);
+
----------------
Nico Rieck wrote:
> Reid Kleckner wrote:
> > We shouldn't be adding these attributes to FieldDecls. I suppose we want to export nested classes, though.
> I'd use a whitelist and only propagate it to methods and static data members. Nested classes aren't automatically exported or imported.
Oops, this fell out when I merged the separate function into this loop. Fixed now.
http://reviews.llvm.org/D3877
More information about the cfe-commits
mailing list