================
@@ -0,0 +1,44 @@
+// RUN: %clang_cc1 -ast-dump -ast-dump-filter=two_on_first %s \
+// RUN:   | FileCheck --check-prefix=TWO --implicit-check-not=SwiftAttrAttr %s
+// RUN: %clang_cc1 -ast-dump -ast-dump-filter=split %s \
+// RUN:   | FileCheck --check-prefix=SPLIT --implicit-check-not=SwiftAttrAttr 
%s
+// RUN: %clang_cc1 -ast-dump -ast-dump-filter=dedup %s \
+// RUN:   | FileCheck --check-prefix=DEDUP --implicit-check-not=SwiftAttrAttr 
%s
+
+// 'swift_attr' is a bag of independent annotations identified by its string
+// argument, so a redeclaration inherits all of them, not just the first.
+
+__attribute__((swift_attr("@a"))) __attribute__((swift_attr("@b")))
+void two_on_first(void);
+void two_on_first(void);
+
+// TWO:      FunctionDecl {{.*}} two_on_first
+// TWO-NEXT:   SwiftAttrAttr {{.*}} "@a"
+// TWO-NEXT:   SwiftAttrAttr {{.*}} "@b"
+// TWO:      FunctionDecl {{.*}} prev {{.*}} two_on_first
+// TWO-NEXT:   SwiftAttrAttr {{.*}} Inherited "@a"
+// TWO-NEXT:   SwiftAttrAttr {{.*}} Inherited "@b"
+
+// A 'swift_attr' on the redeclaration must not suppress inheriting the
+// different ones from the previous declaration.
+__attribute__((swift_attr("@x"))) void split(void);
+__attribute__((swift_attr("@y"))) void split(void);
+
+// SPLIT:      FunctionDecl {{.*}} split
+// SPLIT-NEXT:   SwiftAttrAttr {{.*}} "@x"
+// SPLIT:      FunctionDecl {{.*}} prev {{.*}} split
+// SPLIT-NEXT:   SwiftAttrAttr {{.*}} Inherited "@x"
+// SPLIT-NEXT:   SwiftAttrAttr {{.*}} "@y"
+
+// Identical annotations are still deduplicated, so a chain of redeclarations
+// does not accumulate copies.
+__attribute__((swift_attr("@same"))) void dedup(void);
----------------
j-hui wrote:

Ditto with this

https://github.com/llvm/llvm-project/pull/217187
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to