=?utf-8?b?R8OhYm9yIFTDs3RodsOhcmk=?= <tigbrc...@protonmail.com>, =?utf-8?b?R8OhYm9yIFTDs3RodsOhcmk=?= <tigbrc...@protonmail.com>, =?utf-8?b?R8OhYm9yIFTDs3RodsOhcmk=?= <tigbrc...@protonmail.com>, =?utf-8?b?R8OhYm9yIFTDs3RodsOhcmk=?= <tigbrc...@protonmail.com>, =?utf-8?b?R8OhYm9yIFTDs3RodsOhcmk=?= <tigbrc...@protonmail.com>, =?utf-8?b?R8OhYm9yIFTDs3RodsOhcmk=?= <tigbrc...@protonmail.com>, =?utf-8?b?R8OhYm9yIFTDs3RodsOhcmk=?= <tigbrc...@protonmail.com> Message-ID: In-Reply-To: <llvm.org/llvm/llvm-project/pull/89...@github.com>
================ @@ -16,39 +16,74 @@ using namespace clang::ast_matchers; namespace clang::tidy::bugprone { -const char StrictModeOptionName[] = "StrictMode"; -const char EnableCountingEnumHeuristicOptionName[] = +static constexpr llvm::StringLiteral StrictModeOptionName = "StrictMode"; +static constexpr llvm::StringLiteral EnableCountingEnumHeuristicOptionName = "EnableCountingEnumHeuristic"; -const char CountingEnumPrefixesOptionName[] = "CountingEnumPrefixes"; -const char CountingEnumSuffixesOptionName[] = "CountingEnumSuffixes"; +static constexpr llvm::StringLiteral CountingEnumPrefixesOptionName = + "CountingEnumPrefixes"; +static constexpr llvm::StringLiteral CountingEnumSuffixesOptionName = + "CountingEnumSuffixes"; + +static constexpr bool StrictModeOptionDefaultValue = false; +static constexpr bool EnableCountingEnumHeuristicOptionDefaultValue = true; +static constexpr llvm::StringLiteral CountingEnumPrefixesOptionDefaultValue = + ""; +static constexpr llvm::StringLiteral CountingEnumSuffixesOptionDefaultValue = + "count"; + +static constexpr llvm::StringLiteral RootMatchBindName = "root"; +static constexpr llvm::StringLiteral UnionMatchBindName = "union"; +static constexpr llvm::StringLiteral TagMatchBindName = "tags"; + +namespace { +AST_MATCHER(FieldDecl, isUnion) { + const Type *T = Node.getType().getCanonicalType().getTypePtr(); + assert(T); + return T->isUnionType(); +} + +AST_MATCHER(FieldDecl, isEnum) { + const Type *T = Node.getType().getCanonicalType().getTypePtr(); + assert(T); + return T->isEnumeralType(); +} ---------------- tigbr wrote: I don't think these are the same as the ones in the [AST Matcher Reference](https://clang.llvm.org/docs/LibASTMatchersReference.html). In need these matchers to work with `FieldDecls` while those work on `TagDecls`. https://github.com/llvm/llvm-project/pull/89925 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits