Skip to content

Commit 36b4e84

Browse files
committed
Add modular_format attribute sorting test
1 parent 25675a6 commit 36b4e84

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

clang/test/CodeGen/attr-modular-format.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,17 @@ void test_redecl(void) {
2424
redecl("hello");
2525
}
2626

27+
int order1(const char *fmt, ...) __attribute__((modular_format(__modular_printf, "__printf", "a", "b"), format(printf, 1, 2)));
28+
int order2(const char *fmt, ...) __attribute__((modular_format(__modular_printf, "__printf", "b", "a"), format(printf, 1, 2)));
29+
30+
// CHECK-LABEL: define dso_local void @test_order(
31+
// CHECK: {{.*}} = call i32 (ptr, ...) @order1(ptr noundef @.str) #[[ATTR_ORDER:[0-9]+]]
32+
// CHECK: {{.*}} = call i32 (ptr, ...) @order2(ptr noundef @.str) #[[ATTR_ORDER]]
33+
void test_order(void) {
34+
order1("hello");
35+
order2("hello");
36+
}
37+
2738
// CHECK: attributes #[[ATTR]] = { "modular-format"="printf,1,2,__modular_printf,__printf,float" }
2839
// CHECK: attributes #[[ATTR_REDECL]] = { "modular-format"="printf,1,2,__second_impl,__second,three,two" }
40+
// CHECK: attributes #[[ATTR_ORDER]] = { "modular-format"="printf,1,2,__modular_printf,__printf,a,b" }

0 commit comments

Comments
 (0)