]> granicus.if.org Git - clang/commitdiff
Sema: honour dllexport in itanium more faithfully
authorSaleem Abdulrasool <compnerd@compnerd.org>
Fri, 14 Oct 2016 22:25:46 +0000 (22:25 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Fri, 14 Oct 2016 22:25:46 +0000 (22:25 +0000)
Although the itanium environment uses the itanium layout for C++, treat the
dllexport semantics more similarly to the MSVC specification.  This preserves
the existing behaviour for the use of the itanium ABI on non-windows-itanium
environments.  Export the inline definitions too.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284288 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclCXX.cpp
test/CodeGenCXX/windows-itanium-dllexport.cpp [new file with mode: 0644]

index b04bad2e8799e9871740a0ed1a45af05e7d1a5a3..93e626f7d3251ae8d7fe25740e55ba9afbe113f6 100644 (file)
@@ -5546,7 +5546,8 @@ void Sema::checkClassLevelDLLAttribute(CXXRecordDecl *Class) {
 
       if (MD->isInlined()) {
         // MinGW does not import or export inline methods.
-        if (!Context.getTargetInfo().getCXXABI().isMicrosoft())
+        if (!Context.getTargetInfo().getCXXABI().isMicrosoft() &&
+            !Context.getTargetInfo().getTriple().isWindowsItaniumEnvironment())
           continue;
 
         // MSVC versions before 2015 don't export the move assignment operators
diff --git a/test/CodeGenCXX/windows-itanium-dllexport.cpp b/test/CodeGenCXX/windows-itanium-dllexport.cpp
new file mode 100644 (file)
index 0000000..934c6a2
--- /dev/null
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -emit-llvm -triple i686-windows-itanium -fdeclspec %s -o - | FileCheck %s
+
+struct __declspec(dllexport) s {
+  void f() {}
+};
+
+// CHECK: define {{.*}} dllexport {{.*}} @_ZN1saSERKS_
+// CHECK: define {{.*}} dllexport {{.*}} @_ZN1s1fEv
+