Skip to content

Commit

Permalink
Fix note message
Browse files Browse the repository at this point in the history
  • Loading branch information
ahatanak committed May 9, 2024
1 parent c33375c commit 0f18a7a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion clang/lib/Sema/SemaDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4617,7 +4617,7 @@ void Sema::MergeVarDecl(VarDecl *New, LookupResult &Previous) {
for (auto *D = Old; D; D = D->getPreviousDecl()) {
if (D->isThisDeclarationADefinition() != VarDecl::DeclarationOnly) {
Diag(New->getLocation(), diag::warn_weak_import) << New->getDeclName();
Diag(D->getLocation(), diag::note_previous_declaration);
Diag(D->getLocation(), diag::note_previous_definition);
// Remove weak_import attribute on new declaration.
New->dropAttr<WeakImportAttr>();
break;
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Sema/attr-weak.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ struct __attribute__((weak_import)) s1 {}; // expected-warning {{'weak_import' a
static int f(void) __attribute__((weak)); // expected-error {{weak declaration cannot have internal linkage}}
static int x __attribute__((weak)); // expected-error {{weak declaration cannot have internal linkage}}

int C; // expected-note {{previous declaration is here}}
int C; // expected-note {{previous definition is here}}
extern int C __attribute__((weak_import)); // expected-warning {{an already-defined variable is made a weak_import declaration}}

int C2; // expected-note {{previous declaration is here}}
int C2; // expected-note {{previous definition is here}}
extern int C2;
extern int C2 __attribute__((weak_import)); // expected-warning {{an already-defined variable is made a weak_import declaration}}

Expand Down

0 comments on commit 0f18a7a

Please sign in to comment.