[llvm-branch-commits] [cfe-branch] r367805 - Merging r367661:
Hans Wennborg via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Aug 5 00:31:33 PDT 2019
Author: hans
Date: Mon Aug 5 00:31:33 2019
New Revision: 367805
URL: http://llvm.org/viewvc/llvm-project?rev=367805&view=rev
Log:
Merging r367661:
------------------------------------------------------------------------
r367661 | hans | 2019-08-02 09:51:41 +0200 (Fri, 02 Aug 2019) | 5 lines
Don't try emitting dllexported explicitly defaulted non-trivial ctors twice during explicit template instantiation definition (PR42857)
Trying to emit the definition twice triggers an assert.
Differential revision: https://reviews.llvm.org/D65579
------------------------------------------------------------------------
Modified:
cfe/branches/release_90/ (props changed)
cfe/branches/release_90/lib/Sema/SemaDeclCXX.cpp
cfe/branches/release_90/test/CodeGenCXX/dllexport.cpp
Propchange: cfe/branches/release_90/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Aug 5 00:31:33 2019
@@ -1,4 +1,4 @@
/cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:366429,366448,366457,366474,366480,366483,366511,366670,366694,366699,366878,367008,367039,367055,367103,367134,367301,367305,367323,367387,367520,367530
+/cfe/trunk:366429,366448,366457,366474,366480,366483,366511,366670,366694,366699,366878,367008,367039,367055,367103,367134,367301,367305,367323,367387,367520,367530,367661
/cfe/trunk/test:170344
/cfe/trunk/test/SemaTemplate:126920
Modified: cfe/branches/release_90/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_90/lib/Sema/SemaDeclCXX.cpp?rev=367805&r1=367804&r2=367805&view=diff
==============================================================================
--- cfe/branches/release_90/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/branches/release_90/lib/Sema/SemaDeclCXX.cpp Mon Aug 5 00:31:33 2019
@@ -11425,7 +11425,13 @@ void Sema::ActOnFinishCXXNonNestedClass(
std::swap(DelayedDllExportMemberFunctions, WorkList);
for (CXXMethodDecl *M : WorkList) {
DefineImplicitSpecialMember(*this, M, M->getLocation());
- ActOnFinishInlineFunctionDef(M);
+
+ // Pass the method to the consumer to get emitted. This is not necessary
+ // for explicit instantiation definitions, as they will get emitted
+ // anyway.
+ if (M->getParent()->getTemplateSpecializationKind() !=
+ TSK_ExplicitInstantiationDefinition)
+ ActOnFinishInlineFunctionDef(M);
}
}
}
Modified: cfe/branches/release_90/test/CodeGenCXX/dllexport.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_90/test/CodeGenCXX/dllexport.cpp?rev=367805&r1=367804&r2=367805&view=diff
==============================================================================
--- cfe/branches/release_90/test/CodeGenCXX/dllexport.cpp (original)
+++ cfe/branches/release_90/test/CodeGenCXX/dllexport.cpp Mon Aug 5 00:31:33 2019
@@ -860,6 +860,13 @@ struct PR40006 {
};
// M32-DAG: define weak_odr dso_local dllexport x86_thiscallcc %"struct.InClassInits::PR40006"* @"??0PR40006 at InClassInits@@QAE at XZ"
+// PR42857: Clang would try to emit the non-trivial explicitly defaulted
+// dllexport ctor twice when doing an explicit instantiation definition.
+struct Qux { Qux(); };
+template <typename T> struct PR42857 { __declspec(dllexport) PR42857() = default; Qux q; };
+template struct PR42857<int>;
+// M32-DAG: define weak_odr dso_local dllexport x86_thiscallcc %"struct.InClassInits::PR42857"* @"??0?$PR42857 at H@InClassInits@@QAE at XZ"
+
}
// We had an issue where instantiating A would force emission of B's delayed
More information about the llvm-branch-commits
mailing list