Fixes PR26595
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Sorry for the delay. A few minor issues.
clang-tidy/readability/StaticDefinitionInAnonymousNamespaceCheck.cpp | ||
---|---|---|
46 ↗ | (On Diff #50715) | I'd expand the message a bit: "; static is redundant here". |
docs/clang-tidy/checks/readability-static-definition-in-anonymous-namespace.rst | ||
8 ↗ | (On Diff #50715) | nit: in _the_ current _translation_ unit. |
test/clang-tidy/readability-static-definition-in-anonymous-namespace.cpp | ||
1 ↗ | (On Diff #50715) | Please add a couple of tests for different cases with macros. |
9 ↗ | (On Diff #50715) | 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 | ||
---|---|---|
52 ↗ | (On Diff #52534) | DiagnosticBuilder handles hella different stuff. I wonder whether this code works without ->getName()? |
docs/clang-tidy/checks/readability-static-definition-in-anonymous-namespace.rst | ||
9 ↗ | (On Diff #52534) | 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 | ||
32 ↗ | (On Diff #52534) | 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 | ||
---|---|---|
52 ↗ | (On Diff #52534) | Using Def works! |
clang-tidy/readability/StaticDefinitionInAnonymousNamespaceCheck.cpp | ||
---|---|---|
49 ↗ | (On Diff #52552) | nit: auto? |
docs/clang-tidy/checks/readability-static-definition-in-anonymous-namespace.rst | ||
8 ↗ | (On Diff #52552) | 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 ↗ | (On Diff #52552) | 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 | ||
---|---|---|
34 ↗ | (On Diff #52661) | Oops. I misunderstood your comment. Done now. |
docs/clang-tidy/checks/readability-static-definition-in-anonymous-namespace.rst | ||
---|---|---|
9 ↗ | (On Diff #52661) | This is still not done. |
test/clang-tidy/readability-static-definition-in-anonymous-namespace.cpp | ||
34 ↗ | (On Diff #52661) | 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. |