Skip to content

Commit 92bfe7a

Browse files
committed
Add attr in preprocessor macro
1 parent c989f97 commit 92bfe7a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

clang/test/AST/attr-print-emit.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,18 @@ class C {
7373
// CHECK: void pwtt(void *, int) __attribute__((pointer_with_type_tag(foo, 2, 3)));
7474
void pwtt(void *, int) __attribute__((pointer_with_type_tag(foo, 2, 3)));
7575
};
76+
77+
#define ANNOTATE_ATTR __attribute__((annotate("Annotated")))
78+
ANNOTATE_ATTR int annotated_attr ANNOTATE_ATTR = 0;
79+
// CHECK: __attribute__((annotate("Annotated"))) int annotated_attr __attribute__((annotate("Annotated"))) = 0;
80+
81+
// FIXME: We do not print the attribute as written after the type specifier.
82+
int ANNOTATE_ATTR annotated_attr_fixme = 0;
83+
// CHECK: __attribute__((annotate("Annotated"))) int annotated_attr_fixme = 0;
84+
85+
#define NONNULL_ATTR __attribute__((nonnull(1)))
86+
ANNOTATE_ATTR NONNULL_ATTR void fn_non_null_annotated_attr(int *) __attribute__((annotate("AnnotatedRHS")));
87+
// CHECK:__attribute__((annotate("Annotated"))) __attribute__((nonnull(1))) void fn_non_null_annotated_attr(int *) __attribute__((annotate("AnnotatedRHS")));
88+
89+
[[gnu::nonnull(1)]] [[gnu::always_inline]] void cxx11_attr(int*) ANNOTATE_ATTR;
90+
// CHECK: {{\[\[}}gnu::nonnull(1)]] {{\[\[}}gnu::always_inline]] void cxx11_attr(int *) __attribute__((annotate("Annotated")));

0 commit comments

Comments
 (0)