================
@@ -20,6 +20,7 @@ namespace clang::tidy::bugprone {
namespace {
+// NOLINTNEXTLINE(llvm-prefer-static-over-anonymous-namespace)
----------------
vbvictor wrote:
The function `isCompleteAndHasNoZeroValue` is used inside
`AST_MATCHER(EnumDecl, isCompleteAndHasNoZeroValue)` and as a freestanding
function.
If I convert it to static, then there are build errors like:
```
clang-tools-extra/clang-tidy/bugprone/InvalidEnumDefaultInitializationCheck.cpp:37:10:
error: no matching function for call to 'isCompleteAndHasNoZeroValue'
37 | return isCompleteAndHasNoZeroValue(&Node);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
llvm2/llvm-project/clang-tools-extra/clang-tidy/bugprone/InvalidEnumDefaultInitializationCheck.cpp:36:23:
note: candidate function not viable: requires 0 arguments, but 1 was provided
36 | AST_MATCHER(EnumDecl, isCompleteAndHasNoZeroValue) {
| ^
llvm2/llvm-project/clang/include/clang/ASTMatchers/ASTMatchersMacros.h:108:57:
note: expanded from macro 'AST_MATCHER'
108 | inline ::clang::ast_matchers::internal::Matcher<Type> DefineMatcher()
{ \
| ^
llvm2/llvm-project/clang-tools-extra/clang-tidy/bugprone/InvalidEnumDefaultInitializationCheck.cpp:37:10:
error: no viable conversion from returned value of type
'::clang::ast_matchers::internal::Matcher<EnumDecl>' to function return type
'bool'
37 | return isCompleteAndHasNoZeroValue(&Node);
```
In the past I dodge it by renaming ether matcher of function, but here I think
the name is so self-contained that we should leave it as-is..
https://github.com/llvm/llvm-project/pull/165172
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits