Skip to content

Commit 7cbf5b7

Browse files
committed
Add a codegen test for the overwrite behavior
1 parent a1c9f84 commit 7cbf5b7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ void test_order(void) {
3535
order2("hello");
3636
}
3737

38+
int overwrite(const char *fmt, ...) __attribute__((modular_format(__impl1, "__name1", "1"), modular_format(__impl2, "__name2", "2"), format(printf, 1, 2)));
39+
40+
// CHECK-LABEL: define dso_local void @test_overwrite(
41+
// CHECK: {{.*}} = call i32 (ptr, ...) @overwrite(ptr noundef @.str) #[[ATTR_OVERWRITE:[0-9]+]]
42+
void test_overwrite(void) {
43+
overwrite("hello");
44+
}
45+
3846
// CHECK: attributes #[[ATTR]] = { "modular-format"="printf,1,2,__modular_printf,__printf,float" }
3947
// CHECK: attributes #[[ATTR_REDECL]] = { "modular-format"="printf,1,2,__second_impl,__second,three,two" }
4048
// CHECK: attributes #[[ATTR_ORDER]] = { "modular-format"="printf,1,2,__modular_printf,__printf,a,b" }
49+
// CHECK: attributes #[[ATTR_OVERWRITE]] = { "modular-format"="printf,1,2,__impl2,__name2,2" }

0 commit comments

Comments
 (0)