Skip to content

Commit a0c69ea

Browse files
committed
Add attr in preprocessor macro
1 parent 3d30caa commit a0c69ea

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,15 @@ 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"))) {

0 commit comments

Comments
 (0)