Fixes PR26595
Details
Diff Detail
Event Timeline
Sorry for the delay. A few minor issues.
clang-tidy/readability/StaticDefinitionInAnonymousNamespaceCheck.cpp | ||
---|---|---|
47 | I'd expand the message a bit: "; static is redundant here". | |
docs/clang-tidy/checks/readability-static-definition-in-anonymous-namespace.rst | ||
9 | nit: in _the_ current _translation_ unit. | |
test/clang-tidy/readability-static-definition-in-anonymous-namespace.cpp | ||
2 | Please add a couple of tests for different cases with macros. | |
10 | This check is not helpful, it will match static int c = 1; as well, since it's not anchored to the line start. Should be: |
clang-tidy/readability/StaticDefinitionInAnonymousNamespaceCheck.cpp | ||
---|---|---|
53 | DiagnosticBuilder handles hella different stuff. I wonder whether this code works without ->getName()? | |
docs/clang-tidy/checks/readability-static-definition-in-anonymous-namespace.rst | ||
10 | Still reads a bit strange. A bit more wordsmithing: In this case, `static` is redundant, because anonymous namespace limits the visibility of definitions to a single translation unit. | |
test/clang-tidy/readability-static-definition-in-anonymous-namespace.cpp | ||
33 | Please add a CHECK-FIXES for this case as well. Also move the macro definition closer to its usage and add a CHECK-FIXES to ensure it doesn't get changed. Same below. |
Address comments.
clang-tidy/readability/StaticDefinitionInAnonymousNamespaceCheck.cpp | ||
---|---|---|
53 | Using Def works! |
clang-tidy/readability/StaticDefinitionInAnonymousNamespaceCheck.cpp | ||
---|---|---|
49 | nit: auto? | |
docs/clang-tidy/checks/readability-static-definition-in-anonymous-namespace.rst | ||
8 | Double backquotes should be used for inline code snippets (yeah, I know, this is confusing: different flavors of markdown and RST are completely inconsistent in this regard). | |
test/clang-tidy/readability-static-definition-in-anonymous-namespace.cpp | ||
33 | You missed the "Also move the macro definition closer to its usage and add a CHECK-FIXES to ensure it doesn't get changed." part. Same below. |
test/clang-tidy/readability-static-definition-in-anonymous-namespace.cpp | ||
---|---|---|
35 | Oops. I misunderstood your comment. Done now. |
docs/clang-tidy/checks/readability-static-definition-in-anonymous-namespace.rst | ||
---|---|---|
10 | This is still not done. | |
test/clang-tidy/readability-static-definition-in-anonymous-namespace.cpp | ||
35 | 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. |
I'd expand the message a bit: "; static is redundant here".