================
@@ -21,58 +21,22 @@
 #include <memory>
 #include <string>
 
-namespace clang::ssaf {
+using namespace clang;
+using namespace ssaf;
 
 namespace path = llvm::sys::path;
 
-static llvm::StringRef ToolName;
-static llvm::StringRef ToolVersion;
+namespace {
----------------
steakhal wrote:

This is another thing I noticed. In LLVM we try to avoid using the anonymous 
namespaces because it's hard to tell in a PR diff if a symbol is within that 
anon namespace or part of some other namespace - because it's far away from the 
declaration.

Consequently, we prefer `static` for expressing this because that's local.
Understandably, the syntactic noise scales with the number of declarations - 
unlike with an anon namespace.
The other downside of this approach is that classes can't be declared `static`, 
so those must be wrapped within an anon namespace - breaking the uniformity 
among these uses.

Another downside is that if someone accidentally forgets to add the static 
keyword, then suddenly the symbol will be a global symbol - unlike in the anon 
namespace approach.

So each of these have pros and cons, and the LLVM style settled on using static 
aggressively, but I'm also fine bending this rule - as we did already many 
times.
No actions expected.

https://github.com/llvm/llvm-project/pull/187439
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to