[PATCH] D147888: Update declaration message of extern linkage

2023-07-02 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D147888#4467002 , 
@Krishna-13-cyber wrote:

> In D147888#4466998 , @aaron.ballman 
> wrote:
>
>> I think the existing wording is pretty reasonable, changing "non-static 
>> declaration" into "extern declaration" isn't really giving the user any more 
>> information to help them resolve the issue. "please pick exactly one" 
>> doesn't seem likely to help the user either -- they already know there's a 
>> conflict, so picking one is already the solution the user is likely to have 
>> in mind. The hard part for the user is with figuring which one to pick, but 
>> we have no way to help them make that choice. So I'm not certain changes are 
>> needed in this space (I'm not opposed either), but I do think the idea @cjdb 
>> had to combine all these diagnostics into one using `%select` could be 
>> helpful. However, there are enough options that it could also be pretty 
>> complex to reason about. There's static, extern, and thread-local, as well 
>> as "non-" versions of each of those, so there are quite a few combinations.
>
> Yes I agree with this,
> Changing the whole set of diagnostics will be quite challenging, but I think 
> `extern` has an edge over  `non-static` declaration when we are able to see 
> the diagnostics in gcc if are not going with the `pick-exactly one` 
> convention.

I can sort of buy the argument that `extern` has a slight edge, but I think 
what would really help are test cases for all the various combinations so we 
can see them at once (static, extern. no linkage, thread local vs each 
counterpart). I'm concerned that the code you added conflicts with the existing 
code immediately below your changes and the standards wording quoted above your 
changes, but I left a comment on what would make me more comfortable.




Comment at: clang/lib/Sema/SemaDecl.cpp:4641-4657
+  if (New->hasExternalStorage() &&
+  Old->getCanonicalDecl()->getStorageClass() == SC_Static &&
+  Old->isLocalVarDeclOrParm()) {
+Diag(New->getLocation(), diag::err_extern_static) << New->getDeclName();
+Diag(OldLocation, PrevDiag);
+return New->setInvalidDecl();
+  }





Comment at: clang/test/SemaCXX/extern_static.cpp:7
+}
\ No newline at end of file


Be sure to add the newline back.

Also, I think there should be a C run line for the test.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147888/new/

https://reviews.llvm.org/D147888

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147888: Update declaration message of extern linkage

2023-07-02 Thread Krishna Narayanan via Phabricator via cfe-commits
Krishna-13-cyber added a comment.

In D147888#4466998 , @aaron.ballman 
wrote:

> I think the existing wording is pretty reasonable, changing "non-static 
> declaration" into "extern declaration" isn't really giving the user any more 
> information to help them resolve the issue. "please pick exactly one" doesn't 
> seem likely to help the user either -- they already know there's a conflict, 
> so picking one is already the solution the user is likely to have in mind. 
> The hard part for the user is with figuring which one to pick, but we have no 
> way to help them make that choice. So I'm not certain changes are needed in 
> this space (I'm not opposed either), but I do think the idea @cjdb had to 
> combine all these diagnostics into one using `%select` could be helpful. 
> However, there are enough options that it could also be pretty complex to 
> reason about. There's static, extern, and thread-local, as well as "non-" 
> versions of each of those, so there are quite a few combinations.

Yes I agree with this,
Changing the whole set of diagnostics will be quite challenging, but I think 
`extern` has an edge over  `non-static` declaration when we are able to see the 
diagnostics in gcc if are not going with the `pick-exactly one` convention.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147888/new/

https://reviews.llvm.org/D147888

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147888: Update declaration message of extern linkage

2023-07-02 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

I think the existing wording is pretty reasonable, changing "non-static 
declaration" into "extern declaration" isn't really giving the user any more 
information to help them resolve the issue. "please pick exactly one" doesn't 
seem likely to help the user either -- they already know there's a conflict, so 
picking one is already the solution the user is likely to have in mind. The 
hard part for the user is with figuring which one to pick, but we have no way 
to help them make that choice. So I'm not certain changes are needed in this 
space (I'm not opposed either), but I do think the idea @cjdb had to combine 
all these diagnostics into one using `%select` could be helpful. However, there 
are enough options that it could also be pretty complex to reason about. 
There's static, extern, and thread-local, as well as "non-" versions of each of 
those, so there are quite a few combinations.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147888/new/

https://reviews.llvm.org/D147888

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147888: Update declaration message of extern linkage

2023-06-30 Thread Krishna Narayanan via Phabricator via cfe-commits
Krishna-13-cyber added a comment.

In D147888#4463163 , @tbaeder wrote:

> Ping.

Thanks for the ping! Does this require any further modification?
I think if we will have to change the whole set of diagnostics if we go with 
this change of `pick exactly one ` convention.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147888/new/

https://reviews.llvm.org/D147888

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147888: Update declaration message of extern linkage

2023-06-30 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added a comment.

Ping.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147888/new/

https://reviews.llvm.org/D147888

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147888: Update declaration message of extern linkage

2023-04-29 Thread Krishna Narayanan via Phabricator via cfe-commits
Krishna-13-cyber added a comment.

In D147888#4288149 , 
@Krishna-13-cyber wrote:

> I have tried a little modification from my side thinking on a beneficial 
> note. I will make the changes to all the other test files as well if this 
> diagnostic representation goes well after mentor review.
>
> For refactoring and restructuring the whole of the re-declaration would need 
> some time I have been through it and would initiate another patch for that,In 
> the concern of giving or having just one diagnostic for getting all cases of 
> re-declaration would also need multiple conditional or switch statements 
> inside our function block.At present we have the same with conditional 
> statements taking care of each linkage but it has multiple permutations of 
> diagnostic messages which is nice but can be improved.GCC differs only for 
> this case of extern linkage which can be better/precise in clang where as 
> others seem to be more precise in clang than former as I worked out with good 
> number of test cases regarding this.

Ping!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147888/new/

https://reviews.llvm.org/D147888

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147888: Update declaration message of extern linkage

2023-04-21 Thread Krishna Narayanan via Phabricator via cfe-commits
Krishna-13-cyber updated this revision to Diff 515843.
Krishna-13-cyber added a comment.

I have tried a little modification from my side thinking on a beneficial note. 
I will make the changes to all the other test files as well if this diagnostic 
representation goes well after mentor review.

For refactoring and restructuring the whole of the re-declaration would need 
some time I have been through it and would initiate another patch for that,In 
the concern of giving or having just one diagnostic for getting all cases of 
re-declaration would also need multiple conditional or switch statements inside 
our function block.At present we have the same with conditional statements 
taking care of each linkage but it has multiple permutations of diagnostic 
messages which is nice but can be improved.GCC differs only for this case of 
extern linkage which can be better/precise in clang where as others seem to be 
more precise in clang than latter as I worked out with good number of test 
cases regarding .


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147888/new/

https://reviews.llvm.org/D147888

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDecl.cpp
  clang/test/SemaCXX/extern_static.cpp


Index: clang/test/SemaCXX/extern_static.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/extern_static.cpp
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 -Wabstract-vbase-init
+void f(void)
+{
+static int x; // expected-note {{previous definition is here}}
+extern int x; // expected-error {{extern declaration of 'x' follows static 
declaration;Please pick exactly one (static or extern)}}
+}
\ No newline at end of file
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -4637,6 +4637,15 @@
   //   the prior declaration. If no prior declaration is visible, or
   //   if the prior declaration specifies no linkage, then the
   //   identifier has external linkage.
+
+  if (New->hasExternalStorage() &&
+  Old->getCanonicalDecl()->getStorageClass() == SC_Static &&
+  Old->isLocalVarDeclOrParm()) {
+Diag(New->getLocation(), diag::err_extern_static) << New->getDeclName();
+Diag(OldLocation, PrevDiag);
+return New->setInvalidDecl();
+  }
+
   if (New->hasExternalStorage() && Old->hasLinkage())
 /* Okay */;
   else if (New->getCanonicalDecl()->getStorageClass() != SC_Static &&
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -5798,11 +5798,13 @@
   "redeclaring non-static %0 as static is a Microsoft extension">,
   InGroup;
 def err_non_static_static : Error<
-  "non-static declaration of %0 follows static declaration">;
+  "non-static declaration of %0 follows static declaration;Please pick exactly 
one (static or non-static)">;
+def err_extern_static : Error<
+  "extern declaration of %0 follows static declaration;Please pick exactly one 
(static or extern)">;
 def err_extern_non_extern : Error<
-  "extern declaration of %0 follows non-extern declaration">;
+  "extern declaration of %0 follows non-extern declaration;Please pick exactly 
one (non-extern or extern)">;
 def err_non_extern_extern : Error<
-  "non-extern declaration of %0 follows extern declaration">;
+  "non-extern declaration of %0 follows extern declaration;Please pick exactly 
one (extern or non-extern)">;
 def err_non_thread_thread : Error<
   "non-thread-local declaration of %0 follows thread-local declaration">;
 def err_thread_non_thread : Error<


Index: clang/test/SemaCXX/extern_static.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/extern_static.cpp
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 -Wabstract-vbase-init
+void f(void)
+{
+static int x; // expected-note {{previous definition is here}}
+extern int x; // expected-error {{extern declaration of 'x' follows static declaration;Please pick exactly one (static or extern)}}
+}
\ No newline at end of file
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -4637,6 +4637,15 @@
   //   the prior declaration. If no prior declaration is visible, or
   //   if the prior declaration specifies no linkage, then the
   //   identifier has external linkage.
+
+  if (New->hasExternalStorage() &&
+  Old->getCanonicalDecl()->getStorageClass() == SC_Static &&
+  Old->isLocalVarDeclOrParm()) {
+Diag(New->getLocation(), diag::err_extern_static) << New->getDeclName();
+Diag(OldLocation, PrevDiag);
+

[PATCH] D147888: Update declaration message of extern linkage

2023-04-19 Thread Krishna Narayanan via Phabricator via cfe-commits
Krishna-13-cyber added a comment.

In D147888#4274763 , @cjdb wrote:

> I think we should fundamentally rethink this entire category of diagnostic. 
> Rather than having a static diagnostic per offence stating //what// happened, 
> we should instead have a single diagnostic that captures both what happened, 
> why it's bad, and how to fix it. Something along the lines of
>
>   error: 'x' has been declared with incompatible linkage specifiers (static 
> and extern); please pick exactly one
> extern int x;
> ^~
>   note: previous definition here
> static int x;
> ^~
>
> It'd also be more robust from an engineering perspective, since it means that 
> we won't need to add new diagnostic permutations every time a new linkage 
> specifier is added.



In D147888#4274763 , @cjdb wrote:

> I think we should fundamentally rethink this entire category of diagnostic. 
> Rather than having a static diagnostic per offence stating //what// happened, 
> we should instead have a single diagnostic that captures both what happened, 
> why it's bad, and how to fix it. Something along the lines of
>
>   error: 'x' has been declared with incompatible linkage specifiers (static 
> and extern); please pick exactly one
> extern int x;
> ^~
>   note: previous definition here
> static int x;
> ^~
>
> It'd also be more robust from an engineering perspective, since it means that 
> we won't need to add new diagnostic permutations every time a new linkage 
> specifier is added.

I will try giving this a shot
Thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147888/new/

https://reviews.llvm.org/D147888

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147888: Update declaration message of extern linkage

2023-04-17 Thread Christopher Di Bella via Phabricator via cfe-commits
cjdb added a comment.

I think we should fundamentally rethink this entire category of diagnostic. 
Rather than having a static diagnostic per offence stating //what// happened, 
we should instead have a single diagnostic that captures both what happened, 
why it's bad, and how to fix it. Something along the lines of

  error: 'x' has been declared with incompatible linkage specifiers (static and 
extern); please pick exactly one
extern int x;
^~
  note: previous definition here
static int x;
^~

It'd also be more robust from an engineering perspective, since it means that 
we won't need to add new diagnostic permutations every time a new linkage 
specifier is added.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147888/new/

https://reviews.llvm.org/D147888

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147888: Update declaration message of extern linkage

2023-04-12 Thread Krishna Narayanan via Phabricator via cfe-commits
Krishna-13-cyber updated this revision to Diff 512848.
Krishna-13-cyber added a comment.

- Updated with removing redundant flags


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147888/new/

https://reviews.llvm.org/D147888

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDecl.cpp
  clang/test/SemaCXX/extern_static.cpp


Index: clang/test/SemaCXX/extern_static.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/extern_static.cpp
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+void f(void)
+{
+static int x; // expected-note {{previous definition is here}}
+extern int x; // expected-error {{extern declaration of 'x' follows static 
declaration}}
+}
\ No newline at end of file
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -4637,6 +4637,15 @@
   //   the prior declaration. If no prior declaration is visible, or
   //   if the prior declaration specifies no linkage, then the
   //   identifier has external linkage.
+
+  if (New->hasExternalStorage() &&
+  Old->getCanonicalDecl()->getStorageClass() == SC_Static &&
+  Old->isLocalVarDeclOrParm()) {
+Diag(New->getLocation(), diag::err_extern_static) << New->getDeclName();
+Diag(OldLocation, PrevDiag);
+return New->setInvalidDecl();
+  }
+
   if (New->hasExternalStorage() && Old->hasLinkage())
 /* Okay */;
   else if (New->getCanonicalDecl()->getStorageClass() != SC_Static &&
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -5799,6 +5799,8 @@
   InGroup;
 def err_non_static_static : Error<
   "non-static declaration of %0 follows static declaration">;
+def err_extern_static : Error<
+  "extern declaration of %0 follows static declaration">;
 def err_extern_non_extern : Error<
   "extern declaration of %0 follows non-extern declaration">;
 def err_non_extern_extern : Error<


Index: clang/test/SemaCXX/extern_static.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/extern_static.cpp
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+void f(void)
+{
+static int x; // expected-note {{previous definition is here}}
+extern int x; // expected-error {{extern declaration of 'x' follows static declaration}}
+}
\ No newline at end of file
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -4637,6 +4637,15 @@
   //   the prior declaration. If no prior declaration is visible, or
   //   if the prior declaration specifies no linkage, then the
   //   identifier has external linkage.
+
+  if (New->hasExternalStorage() &&
+  Old->getCanonicalDecl()->getStorageClass() == SC_Static &&
+  Old->isLocalVarDeclOrParm()) {
+Diag(New->getLocation(), diag::err_extern_static) << New->getDeclName();
+Diag(OldLocation, PrevDiag);
+return New->setInvalidDecl();
+  }
+
   if (New->hasExternalStorage() && Old->hasLinkage())
 /* Okay */;
   else if (New->getCanonicalDecl()->getStorageClass() != SC_Static &&
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -5799,6 +5799,8 @@
   InGroup;
 def err_non_static_static : Error<
   "non-static declaration of %0 follows static declaration">;
+def err_extern_static : Error<
+  "extern declaration of %0 follows static declaration">;
 def err_extern_non_extern : Error<
   "extern declaration of %0 follows non-extern declaration">;
 def err_non_extern_extern : Error<
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147888: Update declaration message of extern linkage

2023-04-12 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments.



Comment at: clang/test/SemaCXX/extern_static.cpp:1
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 -Wabstract-vbase-init
+void f(void)

That's unnecessary, isn't it?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147888/new/

https://reviews.llvm.org/D147888

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147888: Update declaration message of extern linkage

2023-04-09 Thread Krishna Narayanan via Phabricator via cfe-commits
Krishna-13-cyber created this revision.
Krishna-13-cyber added reviewers: tbaeder, cjdb, aaron.ballman.
Herald added a project: All.
Krishna-13-cyber requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This patch aims to improve the diagnostic to much better precision of 
indicating extern declaration being followed after static declaration rather 
than just generic non-static declaration.

**Example Testcase:** https://godbolt.org/z/zMTda6MGG


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147888

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDecl.cpp
  clang/test/SemaCXX/extern_static.cpp


Index: clang/test/SemaCXX/extern_static.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/extern_static.cpp
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 -Wabstract-vbase-init
+void f(void)
+{
+static int x; // expected-note {{previous definition is here}}
+extern int x; // expected-error {{extern declaration of 'x' follows static 
declaration}}
+}
\ No newline at end of file
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -4637,6 +4637,15 @@
   //   the prior declaration. If no prior declaration is visible, or
   //   if the prior declaration specifies no linkage, then the
   //   identifier has external linkage.
+
+  if (New->hasExternalStorage() &&
+  Old->getCanonicalDecl()->getStorageClass() == SC_Static &&
+  Old->isLocalVarDeclOrParm()) {
+Diag(New->getLocation(), diag::err_extern_static) << New->getDeclName();
+Diag(OldLocation, PrevDiag);
+return New->setInvalidDecl();
+  }
+
   if (New->hasExternalStorage() && Old->hasLinkage())
 /* Okay */;
   else if (New->getCanonicalDecl()->getStorageClass() != SC_Static &&
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -5799,6 +5799,8 @@
   InGroup;
 def err_non_static_static : Error<
   "non-static declaration of %0 follows static declaration">;
+def err_extern_static : Error<
+  "extern declaration of %0 follows static declaration">;
 def err_extern_non_extern : Error<
   "extern declaration of %0 follows non-extern declaration">;
 def err_non_extern_extern : Error<


Index: clang/test/SemaCXX/extern_static.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/extern_static.cpp
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 -Wabstract-vbase-init
+void f(void)
+{
+static int x; // expected-note {{previous definition is here}}
+extern int x; // expected-error {{extern declaration of 'x' follows static declaration}}
+}
\ No newline at end of file
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -4637,6 +4637,15 @@
   //   the prior declaration. If no prior declaration is visible, or
   //   if the prior declaration specifies no linkage, then the
   //   identifier has external linkage.
+
+  if (New->hasExternalStorage() &&
+  Old->getCanonicalDecl()->getStorageClass() == SC_Static &&
+  Old->isLocalVarDeclOrParm()) {
+Diag(New->getLocation(), diag::err_extern_static) << New->getDeclName();
+Diag(OldLocation, PrevDiag);
+return New->setInvalidDecl();
+  }
+
   if (New->hasExternalStorage() && Old->hasLinkage())
 /* Okay */;
   else if (New->getCanonicalDecl()->getStorageClass() != SC_Static &&
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -5799,6 +5799,8 @@
   InGroup;
 def err_non_static_static : Error<
   "non-static declaration of %0 follows static declaration">;
+def err_extern_static : Error<
+  "extern declaration of %0 follows static declaration">;
 def err_extern_non_extern : Error<
   "extern declaration of %0 follows non-extern declaration">;
 def err_non_extern_extern : Error<
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits