[PATCH] D147888: Update declaration message of extern linkage

Christopher Di Bella via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 17 11:00:12 PDT 2023


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



More information about the cfe-commits mailing list