Skip to content

Commit d3e466f

Browse files
authored
Merge pull request #9842 from swiftlang/egorzhdan/20240723-apinotes-class-template
🍒[APINotes] Avoid duplicated attributes for class template instantiations
2 parents 9eb07c4 + 4bceb00 commit d3e466f

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

clang/lib/Sema/SemaTemplate.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2119,7 +2119,6 @@ DeclResult Sema::CheckClassTemplate(
21192119
NewClass->startDefinition();
21202120

21212121
ProcessDeclAttributeList(S, NewClass, Attr);
2122-
ProcessAPINotes(NewClass);
21232122

21242123
if (PrevClassTemplate)
21252124
mergeDeclAttributes(NewClass, PrevClassTemplate->getTemplatedDecl());

clang/test/APINotes/Inputs/Headers/Templates.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ struct Box {
66
const T* get_ptr() const { return &value; }
77
};
88

9+
using FloatBox = Box<float>;
910
using IntBox = Box<int>;

clang/test/APINotes/templates.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@
77
// CHECK-BOX: Dumping Box:
88
// CHECK-BOX-NEXT: ClassTemplateDecl {{.+}} imported in Templates Box
99
// CHECK-BOX: SwiftAttrAttr {{.+}} <<invalid sloc>> "import_owned"
10+
11+
// Make sure the attributes aren't duplicated.
12+
// CHECK-BOX-NOT: SwiftAttrAttr {{.+}} <<invalid sloc>> "import_owned"

0 commit comments

Comments
 (0)