Skip to content

Commit 2f524fa

Browse files
committed
Add redeclaration test
1 parent 29ae289 commit 2f524fa

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6800,7 +6800,6 @@ static void handleModularFormat(Sema &S, Decl *D, const ParsedAttr &AL) {
68006800
Aspects.erase(llvm::unique(Aspects), Aspects.end());
68016801

68026802
// TODO: Type checking on identifier
6803-
// TODO: Merge attributes
68046803
D->addAttr(::new (S.Context) ModularFormatAttr(
68056804
S.Context, AL, AL.getArgAsIdent(0)->getIdentifierInfo(), ImplName,
68066805
Aspects.data(), Aspects.size()));

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,14 @@ void test_explicit_format(void) {
1515
myprintf("hello");
1616
}
1717

18+
int redecl(const char *fmt, ...) __attribute__((modular_format(__first_impl, "__first", "one"), format(printf, 1, 2)));
19+
int redecl(const char *fmt, ...) __attribute__((modular_format(__second_impl, "__second", "two", "three")));
20+
21+
// CHECK-LABEL: define dso_local void @test_redecl(
22+
// CHECK: {{.*}} = call i32 (ptr, ...) @redecl(ptr noundef @.str) #[[ATTR_REDECL:[0-9]+]]
23+
void test_redecl(void) {
24+
redecl("hello");
25+
}
26+
1827
// CHECK: attributes #[[ATTR]] = { "modular-format"="printf,1,2,__modular_printf,__printf,float" }
28+
// CHECK: attributes #[[ATTR_REDECL]] = { "modular-format"="printf,1,2,__second_impl,__second,three,two" }

0 commit comments

Comments
 (0)