[PATCH] D18180: [clang-tidy] Add a check to detect static definitions in anonymous namespace.

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 5 00:53:05 PDT 2016


alexfh added inline comments.

================
Comment at: docs/clang-tidy/checks/readability-static-definition-in-anonymous-namespace.rst:9
@@ +8,3 @@
+In this case, `static` is redundant, because anonymous namespace limits the
+visibility of definitions to a single translation unit.
+
----------------
This is still not done.

================
Comment at: test/clang-tidy/readability-static-definition-in-anonymous-namespace.cpp:34
@@ +33,3 @@
+#define DEFINE_STATIC_VAR(x) static int x = 2
+DEFINE_STATIC_VAR(i);
+// CHECK-FIXES: {{^}}DEFINE_STATIC_VAR(i);
----------------
hokein wrote:
> Oops. I misunderstood your comment. Done now.
Sorry for being unclear again: please add

  // CHECK-FIXES: #define DEFINE_STATIC_VAR(x) static int x = 2

to verify that the check doesn't unintentionally remove `static` from the macro definition. Same for the macro above.


http://reviews.llvm.org/D18180





More information about the cfe-commits mailing list