[PATCH] D94646: [clang][MSVC] Fix missing MSInheritanceAttr in template specialization.
Zequan Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 14 10:04:23 PST 2021
zequanwu updated this revision to Diff 316695.
zequanwu marked an inline comment as done.
zequanwu added a comment.
Address comment.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D94646/new/
https://reviews.llvm.org/D94646
Files:
clang/lib/Sema/SemaTemplate.cpp
clang/test/CodeGenCXX/microsoft-abi-member-pointers.cpp
Index: clang/test/CodeGenCXX/microsoft-abi-member-pointers.cpp
===================================================================
--- clang/test/CodeGenCXX/microsoft-abi-member-pointers.cpp
+++ clang/test/CodeGenCXX/microsoft-abi-member-pointers.cpp
@@ -148,6 +148,16 @@
// CHECK-SAME: %"struct.pr43803::C" { { i32, i32, i32 } { i32 8, i32 0, i32 0 }, [4 x i8] undef }]
}
+namespace pr48687 {
+template <typename T> struct A {
+ T value;
+ static constexpr auto address = &A<T>::value;
+};
+extern template class A<float>;
+template class A<float>;
+// CHECK: @"?address@?$A at M@pr48687@@2QQ12 at MQ12@" = weak_odr dso_local constant i32 0, comdat, align 4
+}
+
struct PR26313_Y;
typedef void (PR26313_Y::*PR26313_FUNC)();
struct PR26313_X {
Index: clang/lib/Sema/SemaTemplate.cpp
===================================================================
--- clang/lib/Sema/SemaTemplate.cpp
+++ clang/lib/Sema/SemaTemplate.cpp
@@ -9764,6 +9764,11 @@
dllExportImportClassTemplateSpecialization(*this, Def);
}
+ if (Def->hasAttr<MSInheritanceAttr>()) {
+ Specialization->addAttr(Def->getAttr<MSInheritanceAttr>());
+ Consumer.AssignInheritanceModel(Specialization);
+ }
+
// Set the template specialization kind. Make sure it is set before
// instantiating the members which will trigger ASTConsumer callbacks.
Specialization->setTemplateSpecializationKind(TSK);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94646.316695.patch
Type: text/x-patch
Size: 1406 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210114/d402e282/attachment.bin>
More information about the cfe-commits
mailing list