Based on the comments I see on the issue and the PR for the fix, it seems this may help clarification in the coding standard, so I wanted to see if this something we could add a line about in LLVM coding standard (assuming folks agree with it).
When definitions in a .cpp file do not need to be referenced outside that file, give them internal linkage by declaring them static. Do not use this construct in .h files.
+1 to this. It at least aligns with what I understood the standard to actually be. That being said, I’d be tempted to omit the sentence about .h files as there are (admittedly very limited - I don’t think I’ve ever done it myself) cases where static makes sense.
The final text may also want to reference the section on anonymous namespaces too. I have no specific wording suggestion there.
Sounds reasonable to me. Note that we already have guidance (LLVM Coding Standards — LLVM 21.0.0git documentation) to use static over anon namespaces, it doesn’t mentioned that, yes, you should be making everything static that can be static.