[PATCH] D16632: clang-cl: Take dllexport from original function decl into account
Stephan Bergmann via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 27 07:49:07 PST 2016
sberg created this revision.
sberg added a reviewer: rnk.
sberg added a subscriber: cfe-commits.
...in cases where a member function is redeclared as a friend of a nested class. (LibreOffice happens to get tripped up by this.)
http://reviews.llvm.org/D16632
Files:
lib/CodeGen/CodeGenModule.cpp
test/CodeGenCXX/dllexport.cpp
Index: test/CodeGenCXX/dllexport.cpp
===================================================================
--- test/CodeGenCXX/dllexport.cpp
+++ test/CodeGenCXX/dllexport.cpp
@@ -264,6 +264,16 @@
__declspec(dllexport) void friend1() {}
void friend2() {}
+// MSC-DAG: define dllexport void @"\01?func at Befriended@@SAXXZ"()
+// GNU-DAG: define dllexport void @_ZN10Befriended4funcEv()
+struct __declspec(dllexport) Befriended {
+ static void func();
+ struct Befriending {
+ friend void Befriended::func();
+ };
+};
+void Befriended::func() {}
+
// Implicit declarations can be redeclared with dllexport.
// MSC-DAG: define dllexport noalias i8* @"\01??2@{{YAPAXI|YAPEAX_K}}@Z"(
// GNU-DAG: define dllexport noalias i8* @_Znw{{[yj]}}(
Index: lib/CodeGen/CodeGenModule.cpp
===================================================================
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -765,7 +765,8 @@
if (FD->hasAttr<DLLImportAttr>())
F->setDLLStorageClass(llvm::GlobalVariable::DLLImportStorageClass);
- else if (FD->hasAttr<DLLExportAttr>())
+ else if (FD->hasAttr<DLLExportAttr>() ||
+ FD->getCanonicalDecl()->hasAttr<DLLExportAttr>())
F->setDLLStorageClass(llvm::GlobalVariable::DLLExportStorageClass);
else
F->setDLLStorageClass(llvm::GlobalVariable::DefaultStorageClass);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16632.46138.patch
Type: text/x-patch
Size: 1370 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160127/b6c00afd/attachment-0001.bin>
More information about the cfe-commits
mailing list