[llvm-branch-commits] [clang-tools-extra] 027899d - Remove references to the ast_type_traits namespace
Alexander Kornienko via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Dec 10 16:03:07 PST 2020
Author: Alexander Kornienko
Date: 2020-12-11T00:58:46+01:00
New Revision: 027899dab6ac31a34e17b0f43eeb3d00e310a361
URL: https://github.com/llvm/llvm-project/commit/027899dab6ac31a34e17b0f43eeb3d00e310a361
DIFF: https://github.com/llvm/llvm-project/commit/027899dab6ac31a34e17b0f43eeb3d00e310a361.diff
LOG: Remove references to the ast_type_traits namespace
Follow up to cd62511496938e33c061c90796dd23a5288ff843 /
https://reviews.llvm.org/D74499
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D92994
Added:
Modified:
clang-tools-extra/clang-query/Query.h
clang-tools-extra/clang-query/QueryParser.cpp
clang-tools-extra/clang-query/QueryParser.h
clang-tools-extra/clang-query/QuerySession.h
clang-tools-extra/clang-tidy/abseil/FasterStrsplitDelimiterCheck.cpp
clang-tools-extra/clang-tidy/abseil/RedundantStrcatCallsCheck.cpp
clang-tools-extra/clang-tidy/abseil/StrCatAppendCheck.cpp
clang-tools-extra/clang-tidy/abseil/UpgradeDurationConversionsCheck.cpp
clang-tools-extra/clang-tidy/bugprone/AssertSideEffectCheck.cpp
clang-tools-extra/clang-tidy/bugprone/BoolPointerImplicitConversionCheck.cpp
clang-tools-extra/clang-tidy/bugprone/DanglingHandleCheck.cpp
clang-tools-extra/clang-tidy/bugprone/InaccurateEraseCheck.cpp
clang-tools-extra/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp
clang-tools-extra/clang-tidy/bugprone/IntegerDivisionCheck.cpp
clang-tools-extra/clang-tidy/bugprone/MisplacedOperatorInStrlenInAllocCheck.cpp
clang-tools-extra/clang-tidy/bugprone/MisplacedWideningCastCheck.cpp
clang-tools-extra/clang-tidy/bugprone/ParentVirtualCallCheck.cpp
clang-tools-extra/clang-tidy/bugprone/SignedCharMisuseCheck.cpp
clang-tools-extra/clang-tidy/bugprone/SuspiciousMissingCommaCheck.cpp
clang-tools-extra/clang-tidy/bugprone/SuspiciousStringCompareCheck.cpp
clang-tools-extra/clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp
clang-tools-extra/clang-tidy/bugprone/UndelegatedConstructorCheck.cpp
clang-tools-extra/clang-tidy/bugprone/UnhandledSelfAssignmentCheck.cpp
clang-tools-extra/clang-tidy/bugprone/UnusedRaiiCheck.cpp
clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp
clang-tools-extra/clang-tidy/cert/MutatingCopyCheck.cpp
clang-tools-extra/clang-tidy/cert/ProperlySeededRandomGeneratorCheck.cpp
clang-tools-extra/clang-tidy/cert/StaticObjectExceptionCheck.cpp
clang-tools-extra/clang-tidy/cert/ThrownExceptionTypeCheck.cpp
clang-tools-extra/clang-tidy/cppcoreguidelines/InterfacesGlobalInitCheck.cpp
clang-tools-extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp
clang-tools-extra/clang-tidy/cppcoreguidelines/OwningMemoryCheck.cpp
clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp
clang-tools-extra/clang-tidy/cppcoreguidelines/SlicingCheck.cpp
clang-tools-extra/clang-tidy/fuchsia/StaticallyConstructedObjectsCheck.cpp
clang-tools-extra/clang-tidy/llvm/PreferIsaOrDynCastInConditionalsCheck.cpp
clang-tools-extra/clang-tidy/llvm/PreferRegisterOverUnsignedCheck.cpp
clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp
clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp
clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp
clang-tools-extra/clang-tidy/modernize/ReplaceAutoPtrCheck.cpp
clang-tools-extra/clang-tidy/modernize/ReplaceRandomShuffleCheck.cpp
clang-tools-extra/clang-tidy/modernize/ReturnBracedInitListCheck.cpp
clang-tools-extra/clang-tidy/modernize/ShrinkToFitCheck.cpp
clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp
clang-tools-extra/clang-tidy/modernize/UseBoolLiteralsCheck.cpp
clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp
clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp
clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
clang-tools-extra/clang-tidy/objc/NSInvocationArgumentLifetimeCheck.cpp
clang-tools-extra/clang-tidy/performance/ForRangeCopyCheck.cpp
clang-tools-extra/clang-tidy/performance/ImplicitConversionInLoopCheck.cpp
clang-tools-extra/clang-tidy/performance/InefficientAlgorithmCheck.cpp
clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
clang-tools-extra/clang-tidy/performance/MoveConstructorInitCheck.cpp
clang-tools-extra/clang-tidy/performance/NoAutomaticMoveCheck.cpp
clang-tools-extra/clang-tidy/performance/UnnecessaryCopyInitialization.cpp
clang-tools-extra/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.cpp
clang-tools-extra/clang-tidy/readability/DeleteNullPointerCheck.cpp
clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp
clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.cpp
clang-tools-extra/clang-tidy/readability/MakeMemberFunctionConstCheck.cpp
clang-tools-extra/clang-tidy/readability/MisplacedArrayIndexCheck.cpp
clang-tools-extra/clang-tidy/readability/NonConstParameterCheck.cpp
clang-tools-extra/clang-tidy/readability/RedundantFunctionPtrDereferenceCheck.cpp
clang-tools-extra/clang-tidy/readability/RedundantMemberInitCheck.cpp
clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp
clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp
clang-tools-extra/clang-tidy/readability/StringCompareCheck.cpp
clang-tools-extra/clang-tidy/utils/ExprSequence.cpp
clang-tools-extra/clang-tidy/zircon/TemporaryObjectsCheck.cpp
clang-tools-extra/clangd/AST.cpp
clang-tools-extra/clangd/FindTarget.cpp
clang-tools-extra/clangd/FindTarget.h
clang-tools-extra/clangd/Selection.cpp
clang-tools-extra/clangd/Selection.h
clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp
clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
clang-tools-extra/unittests/clang-query/QueryParserTest.cpp
clang/lib/ASTMatchers/ASTMatchersInternal.cpp
clang/lib/ASTMatchers/Dynamic/Registry.cpp
clang/lib/Analysis/ExprMutationAnalyzer.cpp
clang/lib/Tooling/Transformer/RewriteRule.cpp
clang/unittests/AST/ASTImporterTest.cpp
clang/unittests/AST/ASTTypeTraitsTest.cpp
clang/unittests/AST/SourceLocationTest.cpp
clang/unittests/AST/StmtPrinterTest.cpp
clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
clang/unittests/Analysis/ExprMutationAnalyzerTest.cpp
clang/unittests/Tooling/RangeSelectorTest.cpp
clang/unittests/Tooling/RefactoringCallbacksTest.cpp
clang/unittests/Tooling/StencilTest.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-query/Query.h b/clang-tools-extra/clang-query/Query.h
index 223644fe2e51..4c95195d96c1 100644
--- a/clang-tools-extra/clang-query/Query.h
+++ b/clang-tools-extra/clang-query/Query.h
@@ -120,7 +120,7 @@ template <> struct SetQueryKind<OutputKind> {
static const QueryKind value = QK_SetOutputKind;
};
-template <> struct SetQueryKind<ast_type_traits::TraversalKind> {
+template <> struct SetQueryKind<TraversalKind> {
static const QueryKind value = QK_SetTraversalKind;
};
diff --git a/clang-tools-extra/clang-query/QueryParser.cpp b/clang-tools-extra/clang-query/QueryParser.cpp
index 45a0d425b7c2..b01d8001b669 100644
--- a/clang-tools-extra/clang-query/QueryParser.cpp
+++ b/clang-tools-extra/clang-query/QueryParser.cpp
@@ -128,20 +128,17 @@ template <typename QueryType> QueryRef QueryParser::parseSetOutputKind() {
llvm_unreachable("Invalid output kind");
}
-QueryRef QueryParser::parseSetTraversalKind(
- ast_type_traits::TraversalKind QuerySession::*Var) {
+QueryRef QueryParser::parseSetTraversalKind(TraversalKind QuerySession::*Var) {
StringRef ValStr;
unsigned Value =
LexOrCompleteWord<unsigned>(this, ValStr)
- .Case("AsIs", ast_type_traits::TK_AsIs)
- .Case("IgnoreUnlessSpelledInSource",
- ast_type_traits::TK_IgnoreUnlessSpelledInSource)
+ .Case("AsIs", TK_AsIs)
+ .Case("IgnoreUnlessSpelledInSource", TK_IgnoreUnlessSpelledInSource)
.Default(~0u);
if (Value == ~0u) {
return new InvalidQuery("expected traversal kind, got '" + ValStr + "'");
}
- return new SetQuery<ast_type_traits::TraversalKind>(
- Var, static_cast<ast_type_traits::TraversalKind>(Value));
+ return new SetQuery<TraversalKind>(Var, static_cast<TraversalKind>(Value));
}
QueryRef QueryParser::endQuery(QueryRef Q) {
diff --git a/clang-tools-extra/clang-query/QueryParser.h b/clang-tools-extra/clang-query/QueryParser.h
index 68f420dc0994..ece646024265 100644
--- a/clang-tools-extra/clang-query/QueryParser.h
+++ b/clang-tools-extra/clang-query/QueryParser.h
@@ -43,8 +43,7 @@ class QueryParser {
template <typename T> struct LexOrCompleteWord;
QueryRef parseSetBool(bool QuerySession::*Var);
- QueryRef
- parseSetTraversalKind(ast_type_traits::TraversalKind QuerySession::*Var);
+ QueryRef parseSetTraversalKind(TraversalKind QuerySession::*Var);
template <typename QueryType> QueryRef parseSetOutputKind();
QueryRef completeMatcherExpression();
diff --git a/clang-tools-extra/clang-query/QuerySession.h b/clang-tools-extra/clang-query/QuerySession.h
index 20c788b206a0..31a4900e2619 100644
--- a/clang-tools-extra/clang-query/QuerySession.h
+++ b/clang-tools-extra/clang-query/QuerySession.h
@@ -26,7 +26,7 @@ class QuerySession {
QuerySession(llvm::ArrayRef<std::unique_ptr<ASTUnit>> ASTs)
: ASTs(ASTs), PrintOutput(false), DiagOutput(true),
DetailedASTOutput(false), BindRoot(true), PrintMatcher(false),
- Terminate(false), TK(ast_type_traits::TK_AsIs) {}
+ Terminate(false), TK(TK_AsIs) {}
llvm::ArrayRef<std::unique_ptr<ASTUnit>> ASTs;
@@ -38,7 +38,7 @@ class QuerySession {
bool PrintMatcher;
bool Terminate;
- ast_type_traits::TraversalKind TK;
+ TraversalKind TK;
llvm::StringMap<ast_matchers::dynamic::VariantValue> NamedValues;
};
diff --git a/clang-tools-extra/clang-tidy/abseil/FasterStrsplitDelimiterCheck.cpp b/clang-tools-extra/clang-tidy/abseil/FasterStrsplitDelimiterCheck.cpp
index ef260d9b1f6b..efb3faa7cff8 100644
--- a/clang-tools-extra/clang-tidy/abseil/FasterStrsplitDelimiterCheck.cpp
+++ b/clang-tools-extra/clang-tidy/abseil/FasterStrsplitDelimiterCheck.cpp
@@ -79,7 +79,7 @@ void FasterStrsplitDelimiterCheck::registerMatchers(MatchFinder *Finder) {
// Find uses of absl::StrSplit(..., "x") and absl::StrSplit(...,
// absl::ByAnyChar("x")) to transform them into absl::StrSplit(..., 'x').
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
callExpr(callee(functionDecl(hasName("::absl::StrSplit"))),
hasArgument(1, anyOf(ByAnyCharArg, SingleChar)),
unless(isInTemplateInstantiation()))
@@ -90,7 +90,7 @@ void FasterStrsplitDelimiterCheck::registerMatchers(MatchFinder *Finder) {
// absl::MaxSplits(absl::ByAnyChar("x"), N) to transform them into
// absl::MaxSplits('x', N).
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
callExpr(callee(functionDecl(hasName("::absl::MaxSplits"))),
hasArgument(0, anyOf(ByAnyCharArg,
ignoringParenCasts(SingleChar))),
diff --git a/clang-tools-extra/clang-tidy/abseil/RedundantStrcatCallsCheck.cpp b/clang-tools-extra/clang-tidy/abseil/RedundantStrcatCallsCheck.cpp
index be3fa9a5628b..abcf570abc6e 100644
--- a/clang-tools-extra/clang-tidy/abseil/RedundantStrcatCallsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/abseil/RedundantStrcatCallsCheck.cpp
@@ -68,7 +68,7 @@ const clang::CallExpr* ProcessArgument(const Expr* Arg,
has(callExpr(callee(functionDecl(*Strcat))).bind("StrCat")));
if (const auto *SubStrcatCall = selectFirst<const CallExpr>(
"StrCat",
- match(stmt(traverse(ast_type_traits::TK_AsIs,
+ match(stmt(traverse(TK_AsIs,
anyOf(cxxConstructExpr(IsAlphanum,
hasArgument(0, IsStrcat)),
IsStrcat))),
diff --git a/clang-tools-extra/clang-tidy/abseil/StrCatAppendCheck.cpp b/clang-tools-extra/clang-tidy/abseil/StrCatAppendCheck.cpp
index 7aaf976a9c58..a2586beac387 100644
--- a/clang-tools-extra/clang-tidy/abseil/StrCatAppendCheck.cpp
+++ b/clang-tools-extra/clang-tidy/abseil/StrCatAppendCheck.cpp
@@ -58,7 +58,7 @@ void StrCatAppendCheck::registerMatchers(MatchFinder *Finder) {
// StrCat on the RHS. The first argument of the StrCat call should be the same
// as the LHS. Ignore calls from template instantiations.
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
cxxOperatorCallExpr(
unless(isInTemplateInstantiation()),
hasOverloadedOperatorName("="),
diff --git a/clang-tools-extra/clang-tidy/abseil/UpgradeDurationConversionsCheck.cpp b/clang-tools-extra/clang-tidy/abseil/UpgradeDurationConversionsCheck.cpp
index 4d28d1242f25..208d1df27763 100644
--- a/clang-tools-extra/clang-tidy/abseil/UpgradeDurationConversionsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/abseil/UpgradeDurationConversionsCheck.cpp
@@ -100,17 +100,16 @@ void UpgradeDurationConversionsCheck::registerMatchers(MatchFinder *Finder) {
// `absl::Hours(x)`
// where `x` is not of a built-in type.
Finder->addMatcher(
- traverse(
- ast_type_traits::TK_AsIs,
- implicitCastExpr(anyOf(hasCastKind(CK_UserDefinedConversion),
- has(implicitCastExpr(
- hasCastKind(CK_UserDefinedConversion)))),
- hasParent(callExpr(
- callee(functionDecl(
- DurationFactoryFunction(),
- unless(hasParent(functionTemplateDecl())))),
- hasArgument(0, expr().bind("arg")))))
- .bind("OuterExpr")),
+ traverse(TK_AsIs, implicitCastExpr(
+ anyOf(hasCastKind(CK_UserDefinedConversion),
+ has(implicitCastExpr(
+ hasCastKind(CK_UserDefinedConversion)))),
+ hasParent(callExpr(
+ callee(functionDecl(
+ DurationFactoryFunction(),
+ unless(hasParent(functionTemplateDecl())))),
+ hasArgument(0, expr().bind("arg")))))
+ .bind("OuterExpr")),
this);
}
@@ -120,7 +119,7 @@ void UpgradeDurationConversionsCheck::check(
"implicit conversion to 'int64_t' is deprecated in this context; use an "
"explicit cast instead";
- TraversalKindScope RAII(*Result.Context, ast_type_traits::TK_AsIs);
+ TraversalKindScope RAII(*Result.Context, TK_AsIs);
const auto *ArgExpr = Result.Nodes.getNodeAs<Expr>("arg");
SourceLocation Loc = ArgExpr->getBeginLoc();
diff --git a/clang-tools-extra/clang-tidy/bugprone/AssertSideEffectCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/AssertSideEffectCheck.cpp
index 5cb55639db78..8f7d1d1237e9 100644
--- a/clang-tools-extra/clang-tidy/bugprone/AssertSideEffectCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/AssertSideEffectCheck.cpp
@@ -84,8 +84,7 @@ void AssertSideEffectCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
void AssertSideEffectCheck::registerMatchers(MatchFinder *Finder) {
auto DescendantWithSideEffect =
- traverse(ast_type_traits::TK_AsIs,
- hasDescendant(expr(hasSideEffect(CheckFunctionCalls))));
+ traverse(TK_AsIs, hasDescendant(expr(hasSideEffect(CheckFunctionCalls))));
auto ConditionWithSideEffect = hasCondition(DescendantWithSideEffect);
Finder->addMatcher(
stmt(
diff --git a/clang-tools-extra/clang-tidy/bugprone/BoolPointerImplicitConversionCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/BoolPointerImplicitConversionCheck.cpp
index 17dab1b0f73e..8aae92e40558 100644
--- a/clang-tools-extra/clang-tidy/bugprone/BoolPointerImplicitConversionCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/BoolPointerImplicitConversionCheck.cpp
@@ -19,7 +19,7 @@ void BoolPointerImplicitConversionCheck::registerMatchers(MatchFinder *Finder) {
// condition. Filter negations.
Finder->addMatcher(
traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
ifStmt(
hasCondition(findAll(implicitCastExpr(
unless(hasParent(unaryOperator(hasOperatorName("!")))),
diff --git a/clang-tools-extra/clang-tidy/bugprone/DanglingHandleCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/DanglingHandleCheck.cpp
index 5f771e49f808..ae91533a7c9e 100644
--- a/clang-tools-extra/clang-tidy/bugprone/DanglingHandleCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/DanglingHandleCheck.cpp
@@ -117,7 +117,7 @@ void DanglingHandleCheck::registerMatchersForVariables(MatchFinder *Finder) {
// Find 'Handle foo = ReturnsAValue();'
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
varDecl(hasType(hasUnqualifiedDesugaredType(recordType(
hasDeclaration(cxxRecordDecl(IsAHandle))))),
unless(parmVarDecl()),
@@ -128,7 +128,7 @@ void DanglingHandleCheck::registerMatchersForVariables(MatchFinder *Finder) {
this);
// Find 'foo = ReturnsAValue(); // foo is Handle'
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
cxxOperatorCallExpr(callee(cxxMethodDecl(ofClass(IsAHandle))),
hasOverloadedOperatorName("="),
hasArgument(1, ConvertedHandle))
@@ -136,16 +136,16 @@ void DanglingHandleCheck::registerMatchersForVariables(MatchFinder *Finder) {
this);
// Container insertions that will dangle.
- Finder->addMatcher(traverse(ast_type_traits::TK_AsIs,
- makeContainerMatcher(IsAHandle).bind("bad_stmt")),
- this);
+ Finder->addMatcher(
+ traverse(TK_AsIs, makeContainerMatcher(IsAHandle).bind("bad_stmt")),
+ this);
}
void DanglingHandleCheck::registerMatchersForReturn(MatchFinder *Finder) {
// Return a local.
Finder->addMatcher(
traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
returnStmt(
// The AST contains two constructor calls:
// 1. Value to Handle conversion.
@@ -170,7 +170,7 @@ void DanglingHandleCheck::registerMatchersForReturn(MatchFinder *Finder) {
// Return a temporary.
Finder->addMatcher(
traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
returnStmt(has(exprWithCleanups(has(ignoringParenImpCasts(handleFrom(
IsAHandle, handleFromTemporaryValue(IsAHandle)))))))
.bind("bad_stmt")),
diff --git a/clang-tools-extra/clang-tidy/bugprone/InaccurateEraseCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/InaccurateEraseCheck.cpp
index 19e91b44b41a..8e5a53280183 100644
--- a/clang-tools-extra/clang-tidy/bugprone/InaccurateEraseCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/InaccurateEraseCheck.cpp
@@ -33,7 +33,7 @@ void InaccurateEraseCheck::registerMatchers(MatchFinder *Finder) {
tagType(hasDeclaration(decl(isInStdNamespace())))));
Finder->addMatcher(
traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
cxxMemberCallExpr(
on(anyOf(hasType(DeclInStd), hasType(pointsTo(DeclInStd)))),
callee(cxxMethodDecl(hasName("erase"))), argumentCountIs(1),
diff --git a/clang-tools-extra/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp
index 7b0682b31eb7..500210748f52 100644
--- a/clang-tools-extra/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp
@@ -51,7 +51,7 @@ void IncorrectRoundingsCheck::registerMatchers(MatchFinder *MatchFinder) {
// Find expressions of cast to int of the sum of a floating point expression
// and 0.5.
MatchFinder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
implicitCastExpr(hasImplicitDestinationType(isInteger()),
ignoringParenCasts(binaryOperator(
hasOperatorName("+"), OneSideHalf)))
diff --git a/clang-tools-extra/clang-tidy/bugprone/IntegerDivisionCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/IntegerDivisionCheck.cpp
index 9214a7da2729..f68c2f823ba8 100644
--- a/clang-tools-extra/clang-tidy/bugprone/IntegerDivisionCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/IntegerDivisionCheck.cpp
@@ -30,7 +30,7 @@ void IntegerDivisionCheck::registerMatchers(MatchFinder *Finder) {
callExpr(IntType), explicitCastExpr(IntType), UnaryOperators);
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
binaryOperator(
hasOperatorName("/"), hasLHS(expr(IntType)),
hasRHS(expr(IntType)),
diff --git a/clang-tools-extra/clang-tidy/bugprone/MisplacedOperatorInStrlenInAllocCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/MisplacedOperatorInStrlenInAllocCheck.cpp
index 7c8c26370118..beecfa6be99a 100644
--- a/clang-tools-extra/clang-tidy/bugprone/MisplacedOperatorInStrlenInAllocCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/MisplacedOperatorInStrlenInAllocCheck.cpp
@@ -55,19 +55,17 @@ void MisplacedOperatorInStrlenInAllocCheck::registerMatchers(
declRefExpr(hasDeclaration(Alloc1Func)))));
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
- callExpr(callee(decl(anyOf(Alloc0Func, Alloc0FuncPtr))),
- hasArgument(0, BadArg))
- .bind("Alloc")),
+ traverse(TK_AsIs, callExpr(callee(decl(anyOf(Alloc0Func, Alloc0FuncPtr))),
+ hasArgument(0, BadArg))
+ .bind("Alloc")),
this);
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
- callExpr(callee(decl(anyOf(Alloc1Func, Alloc1FuncPtr))),
- hasArgument(1, BadArg))
- .bind("Alloc")),
+ traverse(TK_AsIs, callExpr(callee(decl(anyOf(Alloc1Func, Alloc1FuncPtr))),
+ hasArgument(1, BadArg))
+ .bind("Alloc")),
this);
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
cxxNewExpr(isArray(), hasArraySize(BadArg)).bind("Alloc")),
this);
}
diff --git a/clang-tools-extra/clang-tidy/bugprone/MisplacedWideningCastCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/MisplacedWideningCastCheck.cpp
index 13f0e41a7a3e..65fa31e580ff 100644
--- a/clang-tools-extra/clang-tidy/bugprone/MisplacedWideningCastCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/MisplacedWideningCastCheck.cpp
@@ -40,8 +40,7 @@ void MisplacedWideningCastCheck::registerMatchers(MatchFinder *Finder) {
implicitCastExpr(hasImplicitDestinationType(isInteger()),
has(ignoringParenImpCasts(Calc)));
const auto Cast =
- traverse(ast_type_traits::TK_AsIs,
- expr(anyOf(ExplicitCast, ImplicitCast)).bind("Cast"));
+ traverse(TK_AsIs, expr(anyOf(ExplicitCast, ImplicitCast)).bind("Cast"));
Finder->addMatcher(varDecl(hasInitializer(Cast)), this);
Finder->addMatcher(returnStmt(hasReturnValue(Cast)), this);
diff --git a/clang-tools-extra/clang-tidy/bugprone/ParentVirtualCallCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/ParentVirtualCallCheck.cpp
index cfe556e55610..6b8b7fc7ffc5 100644
--- a/clang-tools-extra/clang-tidy/bugprone/ParentVirtualCallCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/ParentVirtualCallCheck.cpp
@@ -84,7 +84,7 @@ static std::string getExprAsString(const clang::Expr &E,
void ParentVirtualCallCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(
traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
cxxMemberCallExpr(
callee(memberExpr(hasDescendant(implicitCastExpr(
hasImplicitDestinationType(pointsTo(
diff --git a/clang-tools-extra/clang-tidy/bugprone/SignedCharMisuseCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/SignedCharMisuseCheck.cpp
index f776621e3339..e9d97383cd61 100644
--- a/clang-tools-extra/clang-tidy/bugprone/SignedCharMisuseCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/SignedCharMisuseCheck.cpp
@@ -70,9 +70,8 @@ BindableMatcher<clang::Stmt> SignedCharMisuseCheck::charCastExpression(
// We catch any type of casts to an integer. We need to have these cast
// expressions explicitly to catch only those casts which are direct children
// of the checked expressions. (e.g. assignment, declaration).
- return traverse(ast_type_traits::TK_AsIs,
- expr(anyOf(ImplicitCastExpr, CStyleCastExpr, StaticCastExpr,
- FunctionalCastExpr)));
+ return traverse(TK_AsIs, expr(anyOf(ImplicitCastExpr, CStyleCastExpr,
+ StaticCastExpr, FunctionalCastExpr)));
}
void SignedCharMisuseCheck::registerMatchers(MatchFinder *Finder) {
diff --git a/clang-tools-extra/clang-tidy/bugprone/SuspiciousMissingCommaCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/SuspiciousMissingCommaCheck.cpp
index 3de6dfed6356..8fd1abe03646 100644
--- a/clang-tools-extra/clang-tidy/bugprone/SuspiciousMissingCommaCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/SuspiciousMissingCommaCheck.cpp
@@ -23,7 +23,7 @@ bool isConcatenatedLiteralsOnPurpose(ASTContext *Ctx,
// String literals surrounded by parentheses are assumed to be on purpose.
// i.e.: const char* Array[] = { ("a" "b" "c"), "d", [...] };
- TraversalKindScope RAII(*Ctx, ast_type_traits::TK_AsIs);
+ TraversalKindScope RAII(*Ctx, TK_AsIs);
auto Parents = Ctx->getParents(*Lit);
if (Parents.size() == 1 && Parents[0].get<ParenExpr>() != nullptr)
return true;
diff --git a/clang-tools-extra/clang-tidy/bugprone/SuspiciousStringCompareCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/SuspiciousStringCompareCheck.cpp
index b4def0f9aa9d..b234c3d128ed 100644
--- a/clang-tools-extra/clang-tidy/bugprone/SuspiciousStringCompareCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/SuspiciousStringCompareCheck.cpp
@@ -135,7 +135,7 @@ void SuspiciousStringCompareCheck::registerMatchers(MatchFinder *Finder) {
// Detect suspicious cast to an inconsistant type (i.e. not integer type).
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
implicitCastExpr(unless(hasType(isInteger())),
hasSourceExpression(StringCompareCallExpr))
.bind("invalid-conversion")),
diff --git a/clang-tools-extra/clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp
index 06332af92e37..f5821fe3b616 100644
--- a/clang-tools-extra/clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp
@@ -57,9 +57,8 @@ void TooSmallLoopVariableCheck::registerMatchers(MatchFinder *Finder) {
.bind(LoopVarName);
// We need to catch only those comparisons which contain any integer cast.
- StatementMatcher LoopVarConversionMatcher =
- traverse(ast_type_traits::TK_AsIs,
- implicitCastExpr(hasImplicitDestinationType(isInteger()),
+ StatementMatcher LoopVarConversionMatcher = traverse(
+ TK_AsIs, implicitCastExpr(hasImplicitDestinationType(isInteger()),
has(ignoringParenImpCasts(LoopVarMatcher)))
.bind(LoopVarCastName));
diff --git a/clang-tools-extra/clang-tidy/bugprone/UndelegatedConstructorCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/UndelegatedConstructorCheck.cpp
index 839bc71fa594..76a7a5d0e659 100644
--- a/clang-tools-extra/clang-tidy/bugprone/UndelegatedConstructorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/UndelegatedConstructorCheck.cpp
@@ -56,7 +56,7 @@ void UndelegatedConstructorCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(
traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
compoundStmt(hasParent(cxxConstructorDecl(
ofClass(cxxRecordDecl().bind("parent")))),
forEach(ignoringTemporaryExpr(
diff --git a/clang-tools-extra/clang-tidy/bugprone/UnhandledSelfAssignmentCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/UnhandledSelfAssignmentCheck.cpp
index 1f1158f0479f..7539b51ebd12 100644
--- a/clang-tools-extra/clang-tidy/bugprone/UnhandledSelfAssignmentCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/UnhandledSelfAssignmentCheck.cpp
@@ -52,7 +52,7 @@ void UnhandledSelfAssignmentCheck::registerMatchers(MatchFinder *Finder) {
// In the non-template case, we can search for the copy constructor call.
const auto HasNonTemplateSelfCopy = cxxMethodDecl(
ofClass(cxxRecordDecl(unless(hasAncestor(classTemplateDecl())))),
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
hasDescendant(cxxConstructExpr(hasDeclaration(cxxConstructorDecl(
isCopyConstructor(), ofClass(equalsBoundNode("class"))))))));
diff --git a/clang-tools-extra/clang-tidy/bugprone/UnusedRaiiCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/UnusedRaiiCheck.cpp
index 5e4a0ba6d569..3a52180cf04d 100644
--- a/clang-tools-extra/clang-tidy/bugprone/UnusedRaiiCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/UnusedRaiiCheck.cpp
@@ -32,7 +32,7 @@ void UnusedRaiiCheck::registerMatchers(MatchFinder *Finder) {
unless(has(ignoringParenImpCasts(objcMessageExpr()))))
.bind("temp");
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
exprWithCleanups(
unless(isInTemplateInstantiation()),
hasParent(compoundStmt().bind("compound")),
diff --git a/clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp
index f65c02853a73..9d08dbe1ead7 100644
--- a/clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp
@@ -275,9 +275,8 @@ void UseAfterMoveFinder::getDeclRefs(
unless(inDecltypeOrTemplateArg()))
.bind("declref");
- addDeclRefs(
- match(traverse(ast_type_traits::TK_AsIs, findAll(DeclRefMatcher)),
- *S->getStmt(), *Context));
+ addDeclRefs(match(traverse(TK_AsIs, findAll(DeclRefMatcher)), *S->getStmt(),
+ *Context));
addDeclRefs(match(findAll(cxxOperatorCallExpr(
hasAnyOverloadedOperatorName("*", "->", "[]"),
hasArgument(0, DeclRefMatcher))
@@ -342,7 +341,7 @@ void UseAfterMoveFinder::getReinits(
// Passing variable to a function as a non-const lvalue reference
// (unless that function is std::move()).
callExpr(forEachArgumentWithParam(
- traverse(ast_type_traits::TK_AsIs, DeclRefMatcher),
+ traverse(TK_AsIs, DeclRefMatcher),
unless(parmVarDecl(hasType(
references(qualType(isConstQualified())))))),
unless(callee(functionDecl(hasName("::std::move")))))))
@@ -406,7 +405,7 @@ void UseAfterMoveCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(
traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
// To find the Stmt that we assume performs the actual move, we look
// for the direct ancestor of the std::move() that isn't one of the
// node types ignored by ignoringParenImpCasts().
diff --git a/clang-tools-extra/clang-tidy/cert/MutatingCopyCheck.cpp b/clang-tools-extra/clang-tidy/cert/MutatingCopyCheck.cpp
index 678e7408bf45..fa6e82c1c12b 100644
--- a/clang-tools-extra/clang-tidy/cert/MutatingCopyCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cert/MutatingCopyCheck.cpp
@@ -30,7 +30,7 @@ void MutatingCopyCheck::registerMatchers(MatchFinder *Finder) {
MemberExprOrSourceObject);
const auto IsSourceMutatingAssignment = traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
expr(anyOf(binaryOperator(isAssignmentOperator(), hasLHS(IsPartOfSource))
.bind(MutatingOperatorName),
cxxOperatorCallExpr(isAssignmentOperator(),
diff --git a/clang-tools-extra/clang-tidy/cert/ProperlySeededRandomGeneratorCheck.cpp b/clang-tools-extra/clang-tidy/cert/ProperlySeededRandomGeneratorCheck.cpp
index 3fddbffeb1ed..1165eb9a38a5 100644
--- a/clang-tools-extra/clang-tidy/cert/ProperlySeededRandomGeneratorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cert/ProperlySeededRandomGeneratorCheck.cpp
@@ -62,7 +62,7 @@ void ProperlySeededRandomGeneratorCheck::registerMatchers(MatchFinder *Finder) {
// std::mt19937 engine(x);
// ^
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
cxxConstructExpr(RandomGeneratorEngineTypeMatcher).bind("ctor")),
this);
diff --git a/clang-tools-extra/clang-tidy/cert/StaticObjectExceptionCheck.cpp b/clang-tools-extra/clang-tidy/cert/StaticObjectExceptionCheck.cpp
index 9e255659bee7..61ef166b66c2 100644
--- a/clang-tools-extra/clang-tidy/cert/StaticObjectExceptionCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cert/StaticObjectExceptionCheck.cpp
@@ -22,7 +22,7 @@ void StaticObjectExceptionCheck::registerMatchers(MatchFinder *Finder) {
// initializer that can throw.
Finder->addMatcher(
traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
varDecl(
anyOf(hasThreadStorageDuration(), hasStaticStorageDuration()),
unless(anyOf(isConstexpr(), hasType(cxxRecordDecl(isLambda())),
diff --git a/clang-tools-extra/clang-tidy/cert/ThrownExceptionTypeCheck.cpp b/clang-tools-extra/clang-tidy/cert/ThrownExceptionTypeCheck.cpp
index 6a6aab7eaf6f..6b2579bdfdb7 100644
--- a/clang-tools-extra/clang-tidy/cert/ThrownExceptionTypeCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cert/ThrownExceptionTypeCheck.cpp
@@ -20,7 +20,7 @@ namespace cert {
void ThrownExceptionTypeCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(
traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
cxxThrowExpr(has(ignoringParenImpCasts(
cxxConstructExpr(hasDeclaration(cxxConstructorDecl(
isCopyConstructor(), unless(isNoThrow()))))
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/InterfacesGlobalInitCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/InterfacesGlobalInitCheck.cpp
index fb19daf34172..30a40cdd0370 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/InterfacesGlobalInitCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/InterfacesGlobalInitCheck.cpp
@@ -27,12 +27,12 @@ void InterfacesGlobalInitCheck::registerMatchers(MatchFinder *Finder) {
const auto ReferencesUndefinedGlobalVar = declRefExpr(hasDeclaration(
varDecl(GlobalVarDecl, unless(isDefinition())).bind("referencee")));
- Finder->addMatcher(traverse(ast_type_traits::TK_AsIs,
- varDecl(GlobalVarDecl, isDefinition(),
- hasInitializer(expr(hasDescendant(
- ReferencesUndefinedGlobalVar))))
- .bind("var")),
- this);
+ Finder->addMatcher(
+ traverse(TK_AsIs, varDecl(GlobalVarDecl, isDefinition(),
+ hasInitializer(expr(hasDescendant(
+ ReferencesUndefinedGlobalVar))))
+ .bind("var")),
+ this);
}
void InterfacesGlobalInitCheck::check(const MatchFinder::MatchResult &Result) {
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp
index 3ab300dc499f..6819d6a4174f 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp
@@ -46,16 +46,15 @@ void NarrowingConversionsCheck::registerMatchers(MatchFinder *Finder) {
// i = 0.5;
// void f(int); f(0.5);
Finder->addMatcher(
- traverse(
- ast_type_traits::TK_AsIs,
- implicitCastExpr(hasImplicitDestinationType(
- hasUnqualifiedDesugaredType(builtinType())),
- hasSourceExpression(hasType(
- hasUnqualifiedDesugaredType(builtinType()))),
- unless(hasSourceExpression(IsCeilFloorCallExpr)),
- unless(hasParent(castExpr())),
- unless(isInTemplateInstantiation()))
- .bind("cast")),
+ traverse(TK_AsIs, implicitCastExpr(
+ hasImplicitDestinationType(
+ hasUnqualifiedDesugaredType(builtinType())),
+ hasSourceExpression(hasType(
+ hasUnqualifiedDesugaredType(builtinType()))),
+ unless(hasSourceExpression(IsCeilFloorCallExpr)),
+ unless(hasParent(castExpr())),
+ unless(isInTemplateInstantiation()))
+ .bind("cast")),
this);
// Binary operators:
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/OwningMemoryCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/OwningMemoryCheck.cpp
index 79c1b6ccd615..9e3f0883ccd9 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/OwningMemoryCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/OwningMemoryCheck.cpp
@@ -69,7 +69,7 @@ void OwningMemoryCheck::registerMatchers(MatchFinder *Finder) {
// Find delete expressions that delete non-owners.
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
cxxDeleteExpr(hasDescendant(declRefExpr(unless(ConsideredOwner))
.bind("deleted_variable")))
.bind("delete_expr")),
@@ -83,18 +83,17 @@ void OwningMemoryCheck::registerMatchers(MatchFinder *Finder) {
// resources. This check assumes that all pointer arguments of a legacy
// functions shall be 'gsl::owner<>'.
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
- callExpr(callee(LegacyOwnerConsumers),
- hasAnyArgument(
- expr(unless(ignoringImpCasts(ConsideredOwner)),
- hasType(pointerType()))))
- .bind("legacy_consumer")),
+ traverse(TK_AsIs, callExpr(callee(LegacyOwnerConsumers),
+ hasAnyArgument(expr(
+ unless(ignoringImpCasts(ConsideredOwner)),
+ hasType(pointerType()))))
+ .bind("legacy_consumer")),
this);
// Matching assignment to owners, with the rhs not being an owner nor creating
// one.
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
binaryOperator(isAssignmentOperator(), hasLHS(IsOwnerType),
hasRHS(unless(ConsideredOwner)))
.bind("owner_assignment")),
@@ -102,7 +101,7 @@ void OwningMemoryCheck::registerMatchers(MatchFinder *Finder) {
// Matching initialization of owners with non-owners, nor creating owners.
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
namedDecl(
varDecl(hasInitializer(unless(ConsideredOwner)), IsOwnerType)
.bind("owner_initialization"))),
@@ -120,9 +119,9 @@ void OwningMemoryCheck::registerMatchers(MatchFinder *Finder) {
// Match class member initialization that expects owners, but does not get
// them.
- Finder->addMatcher(traverse(ast_type_traits::TK_AsIs,
- cxxRecordDecl(HasConstructorInitializerForOwner)),
- this);
+ Finder->addMatcher(
+ traverse(TK_AsIs, cxxRecordDecl(HasConstructorInitializerForOwner)),
+ this);
// Matching on assignment operations where the RHS is a newly created owner,
// but the LHS is not an owner.
@@ -136,7 +135,7 @@ void OwningMemoryCheck::registerMatchers(MatchFinder *Finder) {
// created owner, but the LHS is not an owner.
Finder->addMatcher(
traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
namedDecl(
varDecl(eachOf(allOf(hasInitializer(CreatesOwner),
unless(IsOwnerType)),
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp
index 2b80c0ba25d6..160d15e6c0e1 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp
@@ -54,7 +54,7 @@ void ProBoundsArrayToPointerDecayCheck::registerMatchers(MatchFinder *Finder) {
// 2) inside a range-for over an array
// 3) if it converts a string literal to a pointer
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
implicitCastExpr(
unless(hasParent(arraySubscriptExpr())),
unless(hasParentIgnoringImpCasts(explicitCastExpr())),
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/SlicingCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/SlicingCheck.cpp
index 62d752f299d3..93081133190f 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/SlicingCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/SlicingCheck.cpp
@@ -62,11 +62,10 @@ void SlicingCheck::registerMatchers(MatchFinder *Finder) {
// constructor in DerivedDecl's constructors.
unless(IsWithinDerivedCtor));
- Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
- expr(anyOf(SlicesObjectInAssignment, SlicesObjectInCtor))
- .bind("Call")),
- this);
+ Finder->addMatcher(traverse(TK_AsIs, expr(anyOf(SlicesObjectInAssignment,
+ SlicesObjectInCtor))
+ .bind("Call")),
+ this);
}
/// Warns on methods overridden in DerivedDecl with respect to BaseDecl.
diff --git a/clang-tools-extra/clang-tidy/fuchsia/StaticallyConstructedObjectsCheck.cpp b/clang-tools-extra/clang-tidy/fuchsia/StaticallyConstructedObjectsCheck.cpp
index b76c9f5fb6b6..2ec53746fbab 100644
--- a/clang-tools-extra/clang-tidy/fuchsia/StaticallyConstructedObjectsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/fuchsia/StaticallyConstructedObjectsCheck.cpp
@@ -26,10 +26,10 @@ AST_MATCHER(VarDecl, isGlobalStatic) {
void StaticallyConstructedObjectsCheck::registerMatchers(MatchFinder *Finder) {
// Constructing global, non-trivial objects with static storage is
- // disallowed, unless the object is statically initialized with a constexpr
+ // disallowed, unless the object is statically initialized with a constexpr
// constructor or has no explicit constructor.
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
varDecl(
// Match global, statically stored objects...
isGlobalStatic(),
diff --git a/clang-tools-extra/clang-tidy/llvm/PreferIsaOrDynCastInConditionalsCheck.cpp b/clang-tools-extra/clang-tidy/llvm/PreferIsaOrDynCastInConditionalsCheck.cpp
index 13646ccbafa6..132178f892ea 100644
--- a/clang-tools-extra/clang-tidy/llvm/PreferIsaOrDynCastInConditionalsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/llvm/PreferIsaOrDynCastInConditionalsCheck.cpp
@@ -52,7 +52,7 @@ void PreferIsaOrDynCastInConditionalsCheck::registerMatchers(
.bind("rhs");
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
stmt(anyOf(
ifStmt(Any), whileStmt(Any), doStmt(Condition),
binaryOperator(
diff --git a/clang-tools-extra/clang-tidy/llvm/PreferRegisterOverUnsignedCheck.cpp b/clang-tools-extra/clang-tidy/llvm/PreferRegisterOverUnsignedCheck.cpp
index 006c8df1b07c..17e75abd724c 100644
--- a/clang-tools-extra/clang-tidy/llvm/PreferRegisterOverUnsignedCheck.cpp
+++ b/clang-tools-extra/clang-tidy/llvm/PreferRegisterOverUnsignedCheck.cpp
@@ -21,7 +21,7 @@ void PreferRegisterOverUnsignedCheck::registerMatchers(MatchFinder *Finder) {
cxxRecordDecl(hasName("::llvm::Register")).bind("registerClassDecl"));
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
valueDecl(allOf(
hasType(qualType(isUnsignedInteger()).bind("varType")),
varDecl(hasInitializer(exprWithCleanups(
diff --git a/clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp b/clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp
index 5d3d3c46edb4..9217c22b07bc 100644
--- a/clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp
@@ -366,7 +366,7 @@ static bool hasSameOperatorParent(const Expr *TheExpr,
ASTContext &Context) {
// IgnoreParenImpCasts logic in reverse: skip surrounding uninteresting nodes
const DynTypedNodeList Parents = Context.getParents(*TheExpr);
- for (ast_type_traits::DynTypedNode DynParent : Parents) {
+ for (DynTypedNode DynParent : Parents) {
if (const auto *Parent = DynParent.get<Expr>()) {
bool Skip = isa<ParenExpr>(Parent) || isa<ImplicitCastExpr>(Parent) ||
isa<FullExpr>(Parent) ||
@@ -420,16 +420,14 @@ markDuplicateOperands(const TExpr *TheExpr,
if (areEquivalentExpr(AllOperands[I], AllOperands[J])) {
FoundDuplicates = true;
Duplicates.set(J);
- Builder->setBinding(
- SmallString<11>(llvm::formatv("duplicate{0}", J)),
- ast_type_traits::DynTypedNode::create(*AllOperands[J]));
+ Builder->setBinding(SmallString<11>(llvm::formatv("duplicate{0}", J)),
+ DynTypedNode::create(*AllOperands[J]));
}
}
if (FoundDuplicates)
- Builder->setBinding(
- SmallString<11>(llvm::formatv("duplicate{0}", I)),
- ast_type_traits::DynTypedNode::create(*AllOperands[I]));
+ Builder->setBinding(SmallString<11>(llvm::formatv("duplicate{0}", I)),
+ DynTypedNode::create(*AllOperands[I]));
}
return Duplicates.any();
@@ -837,7 +835,7 @@ void RedundantExpressionCheck::registerMatchers(MatchFinder *Finder) {
// Binary with equivalent operands, like (X != 2 && X != 2).
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
binaryOperator(
anyOf(isComparisonOperator(),
hasAnyOperatorName("-", "/", "%", "|", "&", "^", "&&",
@@ -868,7 +866,7 @@ void RedundantExpressionCheck::registerMatchers(MatchFinder *Finder) {
// Conditional (trenary) operator with equivalent operands, like (Y ? X : X).
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
conditionalOperator(expressionsAreEquivalent(),
// Filter noisy false positives.
unless(conditionalOperatorIsInMacro()),
@@ -878,7 +876,7 @@ void RedundantExpressionCheck::registerMatchers(MatchFinder *Finder) {
// Overloaded operators with equivalent operands.
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
cxxOperatorCallExpr(
hasAnyOverloadedOperatorName("-", "/", "%", "|", "&", "^",
"==", "!=", "<", "<=", ">",
@@ -901,7 +899,7 @@ void RedundantExpressionCheck::registerMatchers(MatchFinder *Finder) {
// Match expressions like: !(1 | 2 | 3)
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
implicitCastExpr(
hasImplicitDestinationType(isInteger()),
has(unaryOperator(
@@ -915,20 +913,19 @@ void RedundantExpressionCheck::registerMatchers(MatchFinder *Finder) {
.bind("logical-bitwise-confusion")))),
this);
- // Match expressions like: (X << 8) & 0xFF
- Finder->addMatcher(
- traverse(
- ast_type_traits::TK_AsIs,
- binaryOperator(
- hasOperatorName("&"),
- hasOperands(
- ignoringParenImpCasts(
- binaryOperator(hasOperatorName("<<"),
- hasRHS(ignoringParenImpCasts(
- integerLiteral().bind("shift-const"))))),
- ignoringParenImpCasts(integerLiteral().bind("and-const"))))
- .bind("left-right-shift-confusion")),
- this);
+ // Match expressions like: (X << 8) & 0xFF
+ Finder->addMatcher(
+ traverse(TK_AsIs,
+ binaryOperator(
+ hasOperatorName("&"),
+ hasOperands(ignoringParenImpCasts(binaryOperator(
+ hasOperatorName("<<"),
+ hasRHS(ignoringParenImpCasts(
+ integerLiteral().bind("shift-const"))))),
+ ignoringParenImpCasts(
+ integerLiteral().bind("and-const"))))
+ .bind("left-right-shift-confusion")),
+ this);
// Match common expressions and apply more checks to find redundant
// sub-expressions.
@@ -942,17 +939,16 @@ void RedundantExpressionCheck::registerMatchers(MatchFinder *Finder) {
const auto SymRight = matchSymbolicExpr("rhs");
// Match expressions like: x <op> 0xFF == 0xF00.
- Finder->addMatcher(traverse(ast_type_traits::TK_AsIs,
- binaryOperator(isComparisonOperator(),
- hasOperands(BinOpCstLeft,
- CstRight))
- .bind("binop-const-compare-to-const")),
- this);
+ Finder->addMatcher(
+ traverse(TK_AsIs, binaryOperator(isComparisonOperator(),
+ hasOperands(BinOpCstLeft, CstRight))
+ .bind("binop-const-compare-to-const")),
+ this);
// Match expressions like: x <op> 0xFF == x.
Finder->addMatcher(
traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
binaryOperator(isComparisonOperator(),
anyOf(allOf(hasLHS(BinOpCstLeft), hasRHS(SymRight)),
allOf(hasLHS(SymRight), hasRHS(BinOpCstLeft))))
@@ -961,7 +957,7 @@ void RedundantExpressionCheck::registerMatchers(MatchFinder *Finder) {
// Match expressions like: x <op> 10 == x <op> 12.
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
binaryOperator(isComparisonOperator(), hasLHS(BinOpCstLeft),
hasRHS(BinOpCstRight),
// Already reported as redundant.
@@ -977,7 +973,7 @@ void RedundantExpressionCheck::registerMatchers(MatchFinder *Finder) {
const auto ComparisonLeft = matchRelationalIntegerConstantExpr("lhs");
const auto ComparisonRight = matchRelationalIntegerConstantExpr("rhs");
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
binaryOperator(hasAnyOperatorName("||", "&&"),
hasLHS(ComparisonLeft), hasRHS(ComparisonRight),
// Already reported as redundant.
diff --git a/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp b/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
index 0562467f5c61..65384afdf5b8 100644
--- a/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
@@ -529,16 +529,11 @@ void LoopConvertCheck::registerPPCallbacks(const SourceManager &SM,
}
void LoopConvertCheck::registerMatchers(MatchFinder *Finder) {
- Finder->addMatcher(traverse(ast_type_traits::TK_AsIs, makeArrayLoopMatcher()),
- this);
- Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs, makeIteratorLoopMatcher(false)), this);
- Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs, makePseudoArrayLoopMatcher()), this);
+ Finder->addMatcher(traverse(TK_AsIs, makeArrayLoopMatcher()), this);
+ Finder->addMatcher(traverse(TK_AsIs, makeIteratorLoopMatcher(false)), this);
+ Finder->addMatcher(traverse(TK_AsIs, makePseudoArrayLoopMatcher()), this);
if (UseReverseRanges)
- Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs, makeIteratorLoopMatcher(true)),
- this);
+ Finder->addMatcher(traverse(TK_AsIs, makeIteratorLoopMatcher(true)), this);
}
/// Given the range of a single declaration, such as:
@@ -965,7 +960,7 @@ void LoopConvertCheck::check(const MatchFinder::MatchResult &Result) {
}
// Find out which qualifiers we have to use in the loop range.
- TraversalKindScope RAII(*Context, ast_type_traits::TK_AsIs);
+ TraversalKindScope RAII(*Context, TK_AsIs);
const UsageResult &Usages = Finder.getUsages();
determineRangeDescriptor(Context, Nodes, Loop, FixerKind, ContainerExpr,
Usages, Descriptor);
diff --git a/clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp b/clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp
index a7aaca1de5bd..41f38ed00fc8 100644
--- a/clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp
@@ -84,7 +84,7 @@ void MakeSmartPtrCheck::registerMatchers(ast_matchers::MatchFinder *Finder) {
Finder->addMatcher(
traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
cxxBindTemporaryExpr(has(ignoringParenImpCasts(
cxxConstructExpr(
hasType(getSmartPointerTypeMatcher()), argumentCountIs(1),
@@ -98,7 +98,7 @@ void MakeSmartPtrCheck::registerMatchers(ast_matchers::MatchFinder *Finder) {
this);
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
cxxMemberCallExpr(
thisPointerType(getSmartPointerTypeMatcher()),
callee(cxxMethodDecl(hasName("reset"))),
@@ -261,7 +261,7 @@ bool MakeSmartPtrCheck::replaceNew(DiagnosticBuilder &Diag,
const CXXNewExpr *New, SourceManager &SM,
ASTContext *Ctx) {
auto SkipParensParents = [&](const Expr *E) {
- TraversalKindScope RAII(*Ctx, ast_type_traits::TK_AsIs);
+ TraversalKindScope RAII(*Ctx, TK_AsIs);
for (const Expr *OldE = nullptr; E != OldE;) {
OldE = E;
diff --git a/clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp b/clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp
index 557bcce63fa1..5acbe9971416 100644
--- a/clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp
@@ -132,7 +132,7 @@ void PassByValueCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
void PassByValueCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(
traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
cxxConstructorDecl(
forEachConstructorInitializer(
cxxCtorInitializer(
diff --git a/clang-tools-extra/clang-tidy/modernize/ReplaceAutoPtrCheck.cpp b/clang-tools-extra/clang-tidy/modernize/ReplaceAutoPtrCheck.cpp
index 2b072172792d..746d2cfed024 100644
--- a/clang-tools-extra/clang-tidy/modernize/ReplaceAutoPtrCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/ReplaceAutoPtrCheck.cpp
@@ -88,7 +88,7 @@ void ReplaceAutoPtrCheck::registerMatchers(MatchFinder *Finder) {
hasArgument(1, MovableArgumentMatcher)),
this);
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
cxxConstructExpr(hasType(AutoPtrType), argumentCountIs(1),
hasArgument(0, MovableArgumentMatcher))),
this);
diff --git a/clang-tools-extra/clang-tidy/modernize/ReplaceRandomShuffleCheck.cpp b/clang-tools-extra/clang-tidy/modernize/ReplaceRandomShuffleCheck.cpp
index 409d1e931730..f21482d165f8 100644
--- a/clang-tools-extra/clang-tidy/modernize/ReplaceRandomShuffleCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/ReplaceRandomShuffleCheck.cpp
@@ -33,7 +33,7 @@ void ReplaceRandomShuffleCheck::registerMatchers(MatchFinder *Finder) {
const auto RandomFunc = hasArgument(2, expr().bind("randomFunc"));
Finder->addMatcher(
traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
callExpr(
anyOf(allOf(Begin, End, argumentCountIs(2)),
allOf(Begin, End, RandomFunc, argumentCountIs(3))),
diff --git a/clang-tools-extra/clang-tidy/modernize/ReturnBracedInitListCheck.cpp b/clang-tools-extra/clang-tidy/modernize/ReturnBracedInitListCheck.cpp
index d94e1cee227a..6dc91e91ffde 100644
--- a/clang-tools-extra/clang-tidy/modernize/ReturnBracedInitListCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/ReturnBracedInitListCheck.cpp
@@ -31,7 +31,7 @@ void ReturnBracedInitListCheck::registerMatchers(MatchFinder *Finder) {
has(ConstructExpr), has(cxxFunctionalCastExpr(has(ConstructExpr)))));
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
functionDecl(
isDefinition(), // Declarations don't have return statements.
returns(unless(anyOf(builtinType(), autoType()))),
diff --git a/clang-tools-extra/clang-tidy/modernize/ShrinkToFitCheck.cpp b/clang-tools-extra/clang-tidy/modernize/ShrinkToFitCheck.cpp
index d967e5283fa0..7911a56a9a75 100644
--- a/clang-tools-extra/clang-tidy/modernize/ShrinkToFitCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/ShrinkToFitCheck.cpp
@@ -42,8 +42,8 @@ void ShrinkToFitCheck::registerMatchers(MatchFinder *Finder) {
on(hasType(hasCanonicalType(hasDeclaration(namedDecl(
hasAnyName("std::basic_string", "std::deque", "std::vector")))))),
callee(cxxMethodDecl(hasName("swap"))),
- has(ignoringParenImpCasts(memberExpr(traverse(
- ast_type_traits::TK_AsIs, hasDescendant(CopyCtorCall))))),
+ has(ignoringParenImpCasts(
+ memberExpr(traverse(TK_AsIs, hasDescendant(CopyCtorCall))))),
hasArgument(0, SwapParam.bind("ContainerToShrink")),
unless(isInTemplateInstantiation()))
.bind("CopyAndSwapTrick"),
diff --git a/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp
index f15b734c55d6..fab13cdbfe9f 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp
@@ -281,8 +281,7 @@ void UseAutoCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
}
void UseAutoCheck::registerMatchers(MatchFinder *Finder) {
- Finder->addMatcher(traverse(ast_type_traits::TK_AsIs, makeCombinedMatcher()),
- this);
+ Finder->addMatcher(traverse(TK_AsIs, makeCombinedMatcher()), this);
}
void UseAutoCheck::replaceIterators(const DeclStmt *D, ASTContext *Context) {
diff --git a/clang-tools-extra/clang-tidy/modernize/UseBoolLiteralsCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseBoolLiteralsCheck.cpp
index 3dab7437021b..ad11e39f1f1b 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseBoolLiteralsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseBoolLiteralsCheck.cpp
@@ -29,7 +29,7 @@ void UseBoolLiteralsCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
void UseBoolLiteralsCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(
traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
implicitCastExpr(
has(ignoringParenImpCasts(integerLiteral().bind("literal"))),
hasImplicitDestinationType(qualType(booleanType())),
@@ -38,7 +38,7 @@ void UseBoolLiteralsCheck::registerMatchers(MatchFinder *Finder) {
this);
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
conditionalOperator(
hasParent(implicitCastExpr(
hasImplicitDestinationType(qualType(booleanType())),
diff --git a/clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp
index 77d84bd340f6..8ddcf3ddf694 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp
@@ -110,10 +110,9 @@ void UseEmplaceCheck::registerMatchers(MatchFinder *Finder) {
HasConstructExpr, has(cxxFunctionalCastExpr(HasConstructExpr))));
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
- cxxMemberCallExpr(CallPushBack, has(SoughtParam),
- unless(isInTemplateInstantiation()))
- .bind("call")),
+ traverse(TK_AsIs, cxxMemberCallExpr(CallPushBack, has(SoughtParam),
+ unless(isInTemplateInstantiation()))
+ .bind("call")),
this);
}
diff --git a/clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp
index 23e48c0a9ab2..d1d25825ba93 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp
@@ -75,7 +75,7 @@ static bool isCopyConstructorAndCanBeDefaulted(ASTContext *Context,
// The initialization of a base class should be a call to a copy
// constructor of the base.
if (match(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
cxxConstructorDecl(
forEachConstructorInitializer(cxxCtorInitializer(
isBaseInitializer(),
@@ -96,7 +96,7 @@ static bool isCopyConstructorAndCanBeDefaulted(ASTContext *Context,
auto AccessToFieldInParam = accessToFieldInVar(Field, Param);
// The initialization is a CXXConstructExpr for class types.
if (match(traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
cxxConstructorDecl(
forEachConstructorInitializer(cxxCtorInitializer(
isMemberInitializer(), forField(equalsNode(Field)),
@@ -137,7 +137,7 @@ static bool isCopyAssignmentAndCanBeDefaulted(ASTContext *Context,
// return *this;
if (Compound->body_empty() ||
match(traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
returnStmt(has(ignoringParenImpCasts(unaryOperator(
hasOperatorName("*"), hasUnaryOperand(cxxThisExpr())))))),
*Compound->body_back(), *Context)
@@ -153,7 +153,7 @@ static bool isCopyAssignmentAndCanBeDefaulted(ASTContext *Context,
// ((Base*)this)->operator=((Base)Other);
//
// So we are looking for a member call that fulfills:
- if (match(traverse(ast_type_traits::TK_AsIs,
+ if (match(traverse(TK_AsIs,
compoundStmt(has(ignoringParenImpCasts(cxxMemberCallExpr(
// - The object is an implicit cast of 'this' to a
// pointer to
@@ -184,7 +184,7 @@ static bool isCopyAssignmentAndCanBeDefaulted(ASTContext *Context,
member(fieldDecl(equalsNode(Field))));
auto RHS = accessToFieldInVar(Field, Param);
if (match(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
compoundStmt(has(ignoringParenImpCasts(stmt(anyOf(
binaryOperator(hasOperatorName("="), hasLHS(LHS),
hasRHS(RHS)),
diff --git a/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
index 7e30c174a615..25a789dd0831 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
@@ -42,7 +42,7 @@ StatementMatcher makeCastSequenceMatcher() {
unless(hasSourceExpression(hasType(sugaredNullptrType()))));
return traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
castExpr(anyOf(ImplicitCastToNull,
explicitCastExpr(hasDescendant(ImplicitCastToNull))),
unless(hasAncestor(explicitCastExpr())))
@@ -277,10 +277,9 @@ class CastSequenceVisitor : public RecursiveASTVisitor<CastSequenceVisitor> {
return false;
// Step 2: Find the first ancestor that doesn't expand from this macro.
- ast_type_traits::DynTypedNode ContainingAncestor;
- if (!findContainingAncestor(
- ast_type_traits::DynTypedNode::create<Stmt>(*CE), MacroLoc,
- ContainingAncestor))
+ DynTypedNode ContainingAncestor;
+ if (!findContainingAncestor(DynTypedNode::create<Stmt>(*CE), MacroLoc,
+ ContainingAncestor))
return false;
// Step 3:
@@ -407,9 +406,8 @@ class CastSequenceVisitor : public RecursiveASTVisitor<CastSequenceVisitor> {
///
/// \pre MacroLoc.isFileID()
/// \returns true if such an ancestor was found, false otherwise.
- bool findContainingAncestor(ast_type_traits::DynTypedNode Start,
- SourceLocation MacroLoc,
- ast_type_traits::DynTypedNode &Result) {
+ bool findContainingAncestor(DynTypedNode Start, SourceLocation MacroLoc,
+ DynTypedNode &Result) {
// Below we're only following the first parent back up the AST. This should
// be fine since for the statements we care about there should only be one
// parent, except for the case specified below.
@@ -431,7 +429,7 @@ class CastSequenceVisitor : public RecursiveASTVisitor<CastSequenceVisitor> {
}
}
- const ast_type_traits::DynTypedNode &Parent = Parents[0];
+ const DynTypedNode &Parent = Parents[0];
SourceLocation Loc;
if (const auto *D = Parent.get<Decl>())
diff --git a/clang-tools-extra/clang-tidy/objc/NSInvocationArgumentLifetimeCheck.cpp b/clang-tools-extra/clang-tidy/objc/NSInvocationArgumentLifetimeCheck.cpp
index 2b9eee2f0f33..793c6021c398 100644
--- a/clang-tools-extra/clang-tidy/objc/NSInvocationArgumentLifetimeCheck.cpp
+++ b/clang-tools-extra/clang-tidy/objc/NSInvocationArgumentLifetimeCheck.cpp
@@ -101,7 +101,7 @@ fixItHintForVarDecl(const VarDecl *VD, const SourceManager &SM,
void NSInvocationArgumentLifetimeCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(
traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
objcMessageExpr(
hasReceiverType(asString("NSInvocation *")),
anyOf(hasSelector("getArgument:atIndex:"),
diff --git a/clang-tools-extra/clang-tidy/performance/ForRangeCopyCheck.cpp b/clang-tools-extra/clang-tidy/performance/ForRangeCopyCheck.cpp
index 84a4ac922fa5..4b7a34f6c40f 100644
--- a/clang-tools-extra/clang-tidy/performance/ForRangeCopyCheck.cpp
+++ b/clang-tools-extra/clang-tidy/performance/ForRangeCopyCheck.cpp
@@ -50,7 +50,7 @@ void ForRangeCopyCheck::registerMatchers(MatchFinder *Finder) {
unless(hasInitializer(expr(hasDescendant(expr(anyOf(
materializeTemporaryExpr(), IteratorReturnsValueType)))))));
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
cxxForRangeStmt(hasLoopVariable(LoopVar.bind("loopVar")))
.bind("forRange")),
this);
diff --git a/clang-tools-extra/clang-tidy/performance/ImplicitConversionInLoopCheck.cpp b/clang-tools-extra/clang-tidy/performance/ImplicitConversionInLoopCheck.cpp
index 9cddd2b4d31c..38ede424be66 100644
--- a/clang-tools-extra/clang-tidy/performance/ImplicitConversionInLoopCheck.cpp
+++ b/clang-tools-extra/clang-tidy/performance/ImplicitConversionInLoopCheck.cpp
@@ -48,7 +48,7 @@ void ImplicitConversionInLoopCheck::registerMatchers(MatchFinder *Finder) {
// cxxOperatorCallExpr() matcher.
Finder->addMatcher(
traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
cxxForRangeStmt(hasLoopVariable(
varDecl(
hasType(qualType(references(qualType(isConstQualified())))),
diff --git a/clang-tools-extra/clang-tidy/performance/InefficientAlgorithmCheck.cpp b/clang-tools-extra/clang-tidy/performance/InefficientAlgorithmCheck.cpp
index dfea0104614c..8381ed0b1553 100644
--- a/clang-tools-extra/clang-tidy/performance/InefficientAlgorithmCheck.cpp
+++ b/clang-tools-extra/clang-tidy/performance/InefficientAlgorithmCheck.cpp
@@ -36,7 +36,7 @@ void InefficientAlgorithmCheck::registerMatchers(MatchFinder *Finder) {
"::std::unordered_multiset", "::std::unordered_multimap"));
const auto Matcher = traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
callExpr(
callee(functionDecl(Algorithms)),
hasArgument(
diff --git a/clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp b/clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
index 95aa33863d65..0cb1b82782d9 100644
--- a/clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
+++ b/clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
@@ -52,7 +52,7 @@ void MoveConstArgCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(callExpr(ConstParamMatcher).bind("receiving-expr"), this);
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
cxxConstructExpr(ConstParamMatcher).bind("receiving-expr")),
this);
}
diff --git a/clang-tools-extra/clang-tidy/performance/MoveConstructorInitCheck.cpp b/clang-tools-extra/clang-tidy/performance/MoveConstructorInitCheck.cpp
index 6b42cd3180d7..35afa31746df 100644
--- a/clang-tools-extra/clang-tidy/performance/MoveConstructorInitCheck.cpp
+++ b/clang-tools-extra/clang-tidy/performance/MoveConstructorInitCheck.cpp
@@ -28,7 +28,7 @@ MoveConstructorInitCheck::MoveConstructorInitCheck(StringRef Name,
void MoveConstructorInitCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
cxxConstructorDecl(
unless(isImplicit()), isMoveConstructor(),
hasAnyConstructorInitializer(
diff --git a/clang-tools-extra/clang-tidy/performance/NoAutomaticMoveCheck.cpp b/clang-tools-extra/clang-tidy/performance/NoAutomaticMoveCheck.cpp
index 057e10d3c21e..21eba9af0997 100644
--- a/clang-tools-extra/clang-tidy/performance/NoAutomaticMoveCheck.cpp
+++ b/clang-tools-extra/clang-tidy/performance/NoAutomaticMoveCheck.cpp
@@ -44,7 +44,7 @@ void NoAutomaticMoveCheck::registerMatchers(MatchFinder *Finder) {
pointee(type(equalsBoundNode("SrcT")))))))))));
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
returnStmt(hasReturnValue(
ignoringElidableConstructorCall(ignoringParenImpCasts(
cxxConstructExpr(
diff --git a/clang-tools-extra/clang-tidy/performance/UnnecessaryCopyInitialization.cpp b/clang-tools-extra/clang-tidy/performance/UnnecessaryCopyInitialization.cpp
index f6b9365435fb..06cfb24de1ea 100644
--- a/clang-tools-extra/clang-tidy/performance/UnnecessaryCopyInitialization.cpp
+++ b/clang-tools-extra/clang-tidy/performance/UnnecessaryCopyInitialization.cpp
@@ -142,7 +142,7 @@ void UnnecessaryCopyInitialization::registerMatchers(MatchFinder *Finder) {
AllowedTypes)))))),
unless(isImplicit()),
hasInitializer(traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
cxxConstructExpr(
hasDeclaration(cxxConstructorDecl(
isCopyConstructor())),
@@ -170,7 +170,7 @@ void UnnecessaryCopyInitialization::check(
const auto *BlockStmt = Result.Nodes.getNodeAs<Stmt>("blockStmt");
const auto *CtorCall = Result.Nodes.getNodeAs<CXXConstructExpr>("ctorCall");
- TraversalKindScope RAII(*Result.Context, ast_type_traits::TK_AsIs);
+ TraversalKindScope RAII(*Result.Context, TK_AsIs);
// Do not propose fixes if the DeclStmt has multiple VarDecls or in macros
// since we cannot place them correctly.
diff --git a/clang-tools-extra/clang-tidy/performance/UnnecessaryValueParamCheck.cpp b/clang-tools-extra/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
index 12fb2f588539..e3dae9a13558 100644
--- a/clang-tools-extra/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
+++ b/clang-tools-extra/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
@@ -42,7 +42,7 @@ bool isReferencedOutsideOfCallExpr(const FunctionDecl &Function,
bool hasLoopStmtAncestor(const DeclRefExpr &DeclRef, const Decl &Decl,
ASTContext &Context) {
auto Matches = match(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
decl(forEachDescendant(declRefExpr(
equalsNode(&DeclRef),
unless(hasAncestor(stmt(anyOf(forStmt(), cxxForRangeStmt(),
@@ -83,7 +83,7 @@ void UnnecessaryValueParamCheck::registerMatchers(MatchFinder *Finder) {
decl().bind("param"));
Finder->addMatcher(
traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
functionDecl(hasBody(stmt()), isDefinition(), unless(isImplicit()),
unless(cxxMethodDecl(anyOf(isOverride(), isFinal()))),
has(typeLoc(forEach(ExpensiveValueParamDecl))),
@@ -95,7 +95,7 @@ void UnnecessaryValueParamCheck::check(const MatchFinder::MatchResult &Result) {
const auto *Param = Result.Nodes.getNodeAs<ParmVarDecl>("param");
const auto *Function = Result.Nodes.getNodeAs<FunctionDecl>("functionDecl");
- TraversalKindScope RAII(*Result.Context, ast_type_traits::TK_AsIs);
+ TraversalKindScope RAII(*Result.Context, TK_AsIs);
FunctionParmMutationAnalyzer &Analyzer =
MutationAnalyzers.try_emplace(Function, *Function, *Result.Context)
diff --git a/clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.cpp b/clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.cpp
index bcd3e248df77..14a38c09ad9b 100644
--- a/clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.cpp
@@ -40,7 +40,7 @@ void ContainerSizeEmptyCheck::registerMatchers(MatchFinder *Finder) {
.bind("container")))))));
const auto WrongUse = traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
anyOf(
hasParent(binaryOperator(isComparisonOperator(),
hasEitherOperand(ignoringImpCasts(
diff --git a/clang-tools-extra/clang-tidy/readability/DeleteNullPointerCheck.cpp b/clang-tools-extra/clang-tidy/readability/DeleteNullPointerCheck.cpp
index 57b1a0c9e141..16e86c201ff1 100644
--- a/clang-tools-extra/clang-tidy/readability/DeleteNullPointerCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/DeleteNullPointerCheck.cpp
@@ -39,7 +39,7 @@ void DeleteNullPointerCheck::registerMatchers(MatchFinder *Finder) {
hasOperands(castExpr(hasCastKind(CK_NullToPointer)), PointerExpr));
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
ifStmt(hasCondition(
anyOf(PointerCondition, BinaryPointerCheckCondition)),
hasThen(anyOf(DeleteExpr, DeleteMemberExpr,
diff --git a/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp b/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp
index d7a782bfd182..0ff2c066e474 100644
--- a/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp
@@ -222,7 +222,7 @@ bool isCastAllowedInCondition(const ImplicitCastExpr *Cast,
std::queue<const Stmt *> Q;
Q.push(Cast);
- TraversalKindScope RAII(Context, ast_type_traits::TK_AsIs);
+ TraversalKindScope RAII(Context, TK_AsIs);
while (!Q.empty()) {
for (const auto &N : Context.getParents(*Q.front())) {
@@ -276,7 +276,7 @@ void ImplicitBoolConversionCheck::registerMatchers(MatchFinder *Finder) {
binaryOperator(hasOperatorName("^"), hasLHS(implicitCastFromBool),
hasRHS(implicitCastFromBool));
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
implicitCastExpr(
anyOf(hasCastKind(CK_IntegralToBoolean),
hasCastKind(CK_FloatingToBoolean),
@@ -309,7 +309,7 @@ void ImplicitBoolConversionCheck::registerMatchers(MatchFinder *Finder) {
forField(hasBitWidth(1)))));
Finder->addMatcher(
traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
implicitCastExpr(
implicitCastFromBool,
// Exclude comparisons of bools, as they are always cast to
diff --git a/clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.cpp b/clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.cpp
index 18165a619adf..8e81e1bebd1f 100644
--- a/clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.cpp
@@ -127,7 +127,7 @@ void MagicNumbersCheck::registerMatchers(MatchFinder *Finder) {
void MagicNumbersCheck::check(const MatchFinder::MatchResult &Result) {
- TraversalKindScope RAII(*Result.Context, ast_type_traits::TK_AsIs);
+ TraversalKindScope RAII(*Result.Context, TK_AsIs);
checkBoundMatch<IntegerLiteral>(Result, "integer");
checkBoundMatch<FloatingLiteral>(Result, "float");
diff --git a/clang-tools-extra/clang-tidy/readability/MakeMemberFunctionConstCheck.cpp b/clang-tools-extra/clang-tidy/readability/MakeMemberFunctionConstCheck.cpp
index 7a8ad2c3aec6..798343625729 100644
--- a/clang-tools-extra/clang-tidy/readability/MakeMemberFunctionConstCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/MakeMemberFunctionConstCheck.cpp
@@ -212,7 +212,7 @@ AST_MATCHER(CXXMethodDecl, usesThisAsConst) {
void MakeMemberFunctionConstCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(
traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
cxxMethodDecl(
isDefinition(), isUserProvided(),
unless(anyOf(
diff --git a/clang-tools-extra/clang-tidy/readability/MisplacedArrayIndexCheck.cpp b/clang-tools-extra/clang-tidy/readability/MisplacedArrayIndexCheck.cpp
index c5112da413db..5cc4b963b30f 100644
--- a/clang-tools-extra/clang-tidy/readability/MisplacedArrayIndexCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/MisplacedArrayIndexCheck.cpp
@@ -20,10 +20,9 @@ namespace readability {
void MisplacedArrayIndexCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
- arraySubscriptExpr(hasLHS(hasType(isInteger())),
- hasRHS(hasType(isAnyPointer())))
- .bind("expr")),
+ traverse(TK_AsIs, arraySubscriptExpr(hasLHS(hasType(isInteger())),
+ hasRHS(hasType(isAnyPointer())))
+ .bind("expr")),
this);
}
diff --git a/clang-tools-extra/clang-tidy/readability/NonConstParameterCheck.cpp b/clang-tools-extra/clang-tidy/readability/NonConstParameterCheck.cpp
index 688547ca2975..1044df0032d8 100644
--- a/clang-tools-extra/clang-tidy/readability/NonConstParameterCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/NonConstParameterCheck.cpp
@@ -29,7 +29,7 @@ void NonConstParameterCheck::registerMatchers(MatchFinder *Finder) {
// Analyse parameter usage in function.
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
stmt(anyOf(unaryOperator(hasAnyOperatorName("++", "--")),
binaryOperator(), callExpr(), returnStmt(),
cxxConstructExpr()))
diff --git a/clang-tools-extra/clang-tidy/readability/RedundantFunctionPtrDereferenceCheck.cpp b/clang-tools-extra/clang-tidy/readability/RedundantFunctionPtrDereferenceCheck.cpp
index 56565ff2115c..17613785fac0 100644
--- a/clang-tools-extra/clang-tidy/readability/RedundantFunctionPtrDereferenceCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/RedundantFunctionPtrDereferenceCheck.cpp
@@ -17,12 +17,12 @@ namespace tidy {
namespace readability {
void RedundantFunctionPtrDereferenceCheck::registerMatchers(MatchFinder *Finder) {
- Finder->addMatcher(traverse(ast_type_traits::TK_AsIs,
- unaryOperator(hasOperatorName("*"),
- has(implicitCastExpr(hasCastKind(
- CK_FunctionToPointerDecay))))
- .bind("op")),
- this);
+ Finder->addMatcher(
+ traverse(TK_AsIs, unaryOperator(hasOperatorName("*"),
+ has(implicitCastExpr(hasCastKind(
+ CK_FunctionToPointerDecay))))
+ .bind("op")),
+ this);
}
void RedundantFunctionPtrDereferenceCheck::check(const MatchFinder::MatchResult &Result) {
diff --git a/clang-tools-extra/clang-tidy/readability/RedundantMemberInitCheck.cpp b/clang-tools-extra/clang-tidy/readability/RedundantMemberInitCheck.cpp
index 027146f12aad..df6e57bfb9ed 100644
--- a/clang-tools-extra/clang-tidy/readability/RedundantMemberInitCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/RedundantMemberInitCheck.cpp
@@ -34,7 +34,7 @@ void RedundantMemberInitCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(
traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
cxxConstructorDecl(
unless(isDelegatingConstructor()),
ofClass(unless(
diff --git a/clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp b/clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp
index 1f371eed2db8..79211731ff7b 100644
--- a/clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp
@@ -99,7 +99,7 @@ void RedundantStringCStrCheck::registerMatchers(
// check that matched ParamDecl of the ancestor CallExpr is not rvalue.
Finder->addMatcher(
traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
cxxConstructExpr(
StringConstructorExpr, hasArgument(0, StringCStrCallExpr),
unless(anyOf(HasRValueTempParent, hasParent(cxxBindTemporaryExpr(
@@ -158,7 +158,7 @@ void RedundantStringCStrCheck::registerMatchers(
// Detect redundant 'c_str()' calls through a StringRef constructor.
Finder->addMatcher(
traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
cxxConstructExpr(
// Implicit constructors of these classes are overloaded
// wrt. string types and they internally make a StringRef
diff --git a/clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp b/clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp
index 24defc80f161..26c8ae5a3244 100644
--- a/clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp
@@ -97,16 +97,16 @@ void RedundantStringInitCheck::registerMatchers(MatchFinder *Finder) {
const auto StringType = hasType(hasUnqualifiedDesugaredType(
recordType(hasDeclaration(cxxRecordDecl(hasStringTypeName)))));
- const auto EmptyStringInit =
- traverse(ast_type_traits::TK_AsIs, expr(ignoringImplicit(
- anyOf(EmptyStringCtorExpr, EmptyStringCtorExprWithTemporaries))));
+ const auto EmptyStringInit = traverse(
+ TK_AsIs, expr(ignoringImplicit(anyOf(
+ EmptyStringCtorExpr, EmptyStringCtorExprWithTemporaries))));
// Match a variable declaration with an empty string literal as initializer.
// Examples:
// string foo = "";
// string bar("");
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
namedDecl(varDecl(StringType, hasInitializer(EmptyStringInit))
.bind("vardecl"),
unless(parmVarDecl()))),
diff --git a/clang-tools-extra/clang-tidy/readability/StringCompareCheck.cpp b/clang-tools-extra/clang-tidy/readability/StringCompareCheck.cpp
index 19d40c54f12c..d3cf27d1fc3f 100644
--- a/clang-tools-extra/clang-tidy/readability/StringCompareCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/StringCompareCheck.cpp
@@ -32,7 +32,7 @@ void StringCompareCheck::registerMatchers(MatchFinder *Finder) {
// First and second case: cast str.compare(str) to boolean.
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
implicitCastExpr(hasImplicitDestinationType(booleanType()),
has(StrCompare))
.bind("match1")),
diff --git a/clang-tools-extra/clang-tidy/utils/ExprSequence.cpp b/clang-tools-extra/clang-tidy/utils/ExprSequence.cpp
index 15c4375a64be..76e40a3e1d56 100644
--- a/clang-tools-extra/clang-tidy/utils/ExprSequence.cpp
+++ b/clang-tools-extra/clang-tidy/utils/ExprSequence.cpp
@@ -29,14 +29,13 @@ static SmallVector<const Stmt *, 1> getParentStmts(const Stmt *S,
ASTContext *Context) {
SmallVector<const Stmt *, 1> Result;
- TraversalKindScope RAII(*Context, ast_type_traits::TK_AsIs);
+ TraversalKindScope RAII(*Context, TK_AsIs);
DynTypedNodeList Parents = Context->getParents(*S);
- SmallVector<ast_type_traits::DynTypedNode, 1> NodesToProcess(Parents.begin(),
- Parents.end());
+ SmallVector<DynTypedNode, 1> NodesToProcess(Parents.begin(), Parents.end());
while (!NodesToProcess.empty()) {
- ast_type_traits::DynTypedNode Node = NodesToProcess.back();
+ DynTypedNode Node = NodesToProcess.back();
NodesToProcess.pop_back();
if (const auto *S = Node.get<Stmt>()) {
diff --git a/clang-tools-extra/clang-tidy/zircon/TemporaryObjectsCheck.cpp b/clang-tools-extra/clang-tidy/zircon/TemporaryObjectsCheck.cpp
index d816f0ba1866..fa822c3dd8b7 100644
--- a/clang-tools-extra/clang-tidy/zircon/TemporaryObjectsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/zircon/TemporaryObjectsCheck.cpp
@@ -36,7 +36,7 @@ void TemporaryObjectsCheck::registerMatchers(MatchFinder *Finder) {
// Matcher for user-defined constructors.
Finder->addMatcher(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
cxxConstructExpr(hasParent(cxxFunctionalCastExpr()),
hasDeclaration(cxxConstructorDecl(hasParent(
cxxRecordDecl(matchesAnyName(Names))))))
diff --git a/clang-tools-extra/clangd/AST.cpp b/clang-tools-extra/clangd/AST.cpp
index d3615e23b0d6..b0c9ecab1e05 100644
--- a/clang-tools-extra/clangd/AST.cpp
+++ b/clang-tools-extra/clangd/AST.cpp
@@ -303,8 +303,8 @@ SymbolID getSymbolID(const llvm::StringRef MacroName, const MacroInfo *MI,
std::string printType(const QualType QT, const DeclContext &CurContext) {
std::string Result;
llvm::raw_string_ostream OS(Result);
- auto Decls = explicitReferenceTargets(
- ast_type_traits::DynTypedNode::create(QT), DeclRelation::Alias);
+ auto Decls =
+ explicitReferenceTargets(DynTypedNode::create(QT), DeclRelation::Alias);
if (!Decls.empty())
OS << getQualification(CurContext.getParentASTContext(), &CurContext,
Decls.front(),
diff --git a/clang-tools-extra/clangd/FindTarget.cpp b/clang-tools-extra/clangd/FindTarget.cpp
index fbb117c9b2ce..3afd65522680 100644
--- a/clang-tools-extra/clangd/FindTarget.cpp
+++ b/clang-tools-extra/clangd/FindTarget.cpp
@@ -44,10 +44,8 @@
namespace clang {
namespace clangd {
namespace {
-using ast_type_traits::DynTypedNode;
-LLVM_ATTRIBUTE_UNUSED std::string
-nodeToString(const ast_type_traits::DynTypedNode &N) {
+LLVM_ATTRIBUTE_UNUSED std::string nodeToString(const DynTypedNode &N) {
std::string S = std::string(N.getNodeKind().asStringRef());
{
llvm::raw_string_ostream OS(S);
@@ -335,13 +333,11 @@ struct TargetFinder {
RelSet Flags;
template <typename T> void debug(T &Node, RelSet Flags) {
- dlog("visit [{0}] {1}", Flags,
- nodeToString(ast_type_traits::DynTypedNode::create(Node)));
+ dlog("visit [{0}] {1}", Flags, nodeToString(DynTypedNode::create(Node)));
}
void report(const NamedDecl *D, RelSet Flags) {
- dlog("--> [{0}] {1}", Flags,
- nodeToString(ast_type_traits::DynTypedNode::create(*D)));
+ dlog("--> [{0}] {1}", Flags, nodeToString(DynTypedNode::create(*D)));
auto It = Decls.try_emplace(D, std::make_pair(Flags, Decls.size()));
// If already exists, update the flags.
if (!It.second)
@@ -684,7 +680,7 @@ struct TargetFinder {
} // namespace
llvm::SmallVector<std::pair<const NamedDecl *, DeclRelationSet>, 1>
-allTargetDecls(const ast_type_traits::DynTypedNode &N) {
+allTargetDecls(const DynTypedNode &N) {
dlog("allTargetDecls({0})", nodeToString(N));
TargetFinder Finder;
DeclRelationSet Flags;
@@ -708,8 +704,8 @@ allTargetDecls(const ast_type_traits::DynTypedNode &N) {
return Finder.takeDecls();
}
-llvm::SmallVector<const NamedDecl *, 1>
-targetDecl(const ast_type_traits::DynTypedNode &N, DeclRelationSet Mask) {
+llvm::SmallVector<const NamedDecl *, 1> targetDecl(const DynTypedNode &N,
+ DeclRelationSet Mask) {
llvm::SmallVector<const NamedDecl *, 1> Result;
for (const auto &Entry : allTargetDecls(N)) {
if (!(Entry.second & ~Mask))
diff --git a/clang-tools-extra/clangd/FindTarget.h b/clang-tools-extra/clangd/FindTarget.h
index f328ae358c06..435e4f4ac038 100644
--- a/clang-tools-extra/clangd/FindTarget.h
+++ b/clang-tools-extra/clangd/FindTarget.h
@@ -80,15 +80,15 @@ class DeclRelationSet;
/// If callers want to support such decls, they should cast the node directly.
///
/// FIXME: some AST nodes cannot be DynTypedNodes, these cannot be specified.
-llvm::SmallVector<const NamedDecl *, 1>
-targetDecl(const ast_type_traits::DynTypedNode &, DeclRelationSet Mask);
+llvm::SmallVector<const NamedDecl *, 1> targetDecl(const DynTypedNode &,
+ DeclRelationSet Mask);
/// Similar to targetDecl(), however instead of applying a filter, all possible
/// decls are returned along with their DeclRelationSets.
/// This is suitable for indexing, where everything is recorded and filtering
/// is applied later.
llvm::SmallVector<std::pair<const NamedDecl *, DeclRelationSet>, 1>
-allTargetDecls(const ast_type_traits::DynTypedNode &);
+allTargetDecls(const DynTypedNode &);
enum class DeclRelation : unsigned {
// Template options apply when the declaration is an instantiated template.
@@ -162,8 +162,7 @@ void findExplicitReferences(const ASTContext &AST,
/// ^~~ there is no Decl for 'Ptr<int>', so we return the template pattern.
/// \p Mask should not contain TemplatePattern or TemplateInstantiation.
llvm::SmallVector<const NamedDecl *, 1>
-explicitReferenceTargets(ast_type_traits::DynTypedNode N,
- DeclRelationSet Mask);
+explicitReferenceTargets(DynTypedNode N, DeclRelationSet Mask);
// Boring implementation details of bitfield.
diff --git a/clang-tools-extra/clangd/Selection.cpp b/clang-tools-extra/clangd/Selection.cpp
index 7e7aff5bb56c..cec6c035db58 100644
--- a/clang-tools-extra/clangd/Selection.cpp
+++ b/clang-tools-extra/clangd/Selection.cpp
@@ -35,7 +35,6 @@ namespace clang {
namespace clangd {
namespace {
using Node = SelectionTree::Node;
-using ast_type_traits::DynTypedNode;
// Measure the fraction of selections that were enabled by recovery AST.
void recordMetrics(const SelectionTree &S, const LangOptions &Lang) {
diff --git a/clang-tools-extra/clangd/Selection.h b/clang-tools-extra/clangd/Selection.h
index 212cc326571e..775006f40f6c 100644
--- a/clang-tools-extra/clangd/Selection.h
+++ b/clang-tools-extra/clangd/Selection.h
@@ -125,7 +125,7 @@ class SelectionTree {
// Direct children within the selection tree.
llvm::SmallVector<const Node *> Children;
// The corresponding node from the full AST.
- ast_type_traits::DynTypedNode ASTNode;
+ DynTypedNode ASTNode;
// The extent to which this node is covered by the selection.
Selection Selected;
// Walk up the AST to get the DeclContext of this Node,
diff --git a/clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp b/clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp
index 5e588cbb2109..f1c6f666e7d0 100644
--- a/clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp
+++ b/clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp
@@ -84,7 +84,7 @@ llvm::Optional<SourceLocation> getSemicolonForDecl(const FunctionDecl *FD) {
// or the function decl to be selected. Returns null if none of the above
// criteria is met.
const FunctionDecl *getSelectedFunction(const SelectionTree::Node *SelNode) {
- const ast_type_traits::DynTypedNode &AstNode = SelNode->ASTNode;
+ const DynTypedNode &AstNode = SelNode->ASTNode;
if (const FunctionDecl *FD = AstNode.get<FunctionDecl>())
return FD;
if (AstNode.get<CompoundStmt>() &&
diff --git a/clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp b/clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
index 23b0e00d9aa5..6f7ad2e2a541 100644
--- a/clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
+++ b/clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
@@ -51,7 +51,7 @@ namespace {
const FunctionDecl *getSelectedFunction(const SelectionTree::Node *SelNode) {
if (!SelNode)
return nullptr;
- const ast_type_traits::DynTypedNode &AstNode = SelNode->ASTNode;
+ const DynTypedNode &AstNode = SelNode->ASTNode;
if (const FunctionDecl *FD = AstNode.get<FunctionDecl>())
return FD;
if (AstNode.get<CompoundStmt>() &&
diff --git a/clang-tools-extra/unittests/clang-query/QueryParserTest.cpp b/clang-tools-extra/unittests/clang-query/QueryParserTest.cpp
index 78d6f593777d..76ab85680b9f 100644
--- a/clang-tools-extra/unittests/clang-query/QueryParserTest.cpp
+++ b/clang-tools-extra/unittests/clang-query/QueryParserTest.cpp
@@ -112,11 +112,9 @@ TEST_F(QueryParserTest, Set) {
EXPECT_EQ(true, cast<SetQuery<bool> >(Q)->Value);
Q = parse("set traversal AsIs");
- ASSERT_TRUE(isa<SetQuery<ast_type_traits::TraversalKind>>(Q));
- EXPECT_EQ(&QuerySession::TK,
- cast<SetQuery<ast_type_traits::TraversalKind>>(Q)->Var);
- EXPECT_EQ(ast_type_traits::TK_AsIs,
- cast<SetQuery<ast_type_traits::TraversalKind>>(Q)->Value);
+ ASSERT_TRUE(isa<SetQuery<TraversalKind>>(Q));
+ EXPECT_EQ(&QuerySession::TK, cast<SetQuery<TraversalKind>>(Q)->Var);
+ EXPECT_EQ(TK_AsIs, cast<SetQuery<TraversalKind>>(Q)->Value);
Q = parse("set traversal NotATraversal");
ASSERT_TRUE(isa<InvalidQuery>(Q));
diff --git a/clang/lib/ASTMatchers/ASTMatchersInternal.cpp b/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
index 7f96f4bc03af..4cc374c86d00 100644
--- a/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
+++ b/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
@@ -256,8 +256,7 @@ DynTypedMatcher::constructRestrictedWrapper(const DynTypedMatcher &InnerMatcher,
return Copy;
}
-DynTypedMatcher
-DynTypedMatcher::withTraversalKind(ast_type_traits::TraversalKind TK) {
+DynTypedMatcher DynTypedMatcher::withTraversalKind(TraversalKind TK) {
auto Copy = *this;
Copy.Implementation =
new DynTraversalMatcherImpl(TK, std::move(Copy.Implementation));
diff --git a/clang/lib/ASTMatchers/Dynamic/Registry.cpp b/clang/lib/ASTMatchers/Dynamic/Registry.cpp
index 3374ccc86181..87a54d308a50 100644
--- a/clang/lib/ASTMatchers/Dynamic/Registry.cpp
+++ b/clang/lib/ASTMatchers/Dynamic/Registry.cpp
@@ -31,8 +31,6 @@
#include <utility>
#include <vector>
-using namespace clang::ast_type_traits;
-
namespace clang {
namespace ast_matchers {
namespace dynamic {
diff --git a/clang/lib/Analysis/ExprMutationAnalyzer.cpp b/clang/lib/Analysis/ExprMutationAnalyzer.cpp
index c3da5cc47d78..d129c2d480f0 100644
--- a/clang/lib/Analysis/ExprMutationAnalyzer.cpp
+++ b/clang/lib/Analysis/ExprMutationAnalyzer.cpp
@@ -366,7 +366,7 @@ const Stmt *ExprMutationAnalyzer::findDirectMutation(const Expr *Exp) {
hasType(nonConstReferenceType())))));
const auto Matches = match(
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
findAll(stmt(anyOf(AsAssignmentLhs, AsIncDecOperand,
AsNonConstThis, AsAmpersandOperand,
AsPointerFromArrayDecay, AsOperatorArrowThis,
@@ -543,7 +543,7 @@ const Stmt *ExprMutationAnalyzer::findFunctionArgMutation(const Expr *Exp) {
const auto FuncDecl = hasDeclaration(functionDecl().bind("func"));
const auto Matches = match(
traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
findAll(
expr(anyOf(callExpr(NonConstRefParam, IsInstantiated, FuncDecl,
unless(callee(namedDecl(hasAnyName(
diff --git a/clang/lib/Tooling/Transformer/RewriteRule.cpp b/clang/lib/Tooling/Transformer/RewriteRule.cpp
index 543d014ab1a4..acff1e83c4e1 100644
--- a/clang/lib/Tooling/Transformer/RewriteRule.cpp
+++ b/clang/lib/Tooling/Transformer/RewriteRule.cpp
@@ -342,7 +342,7 @@ static bool hasValidKind(const DynTypedMatcher &M) {
static std::vector<DynTypedMatcher> taggedMatchers(
StringRef TagBase,
const SmallVectorImpl<std::pair<size_t, RewriteRule::Case>> &Cases,
- ast_type_traits::TraversalKind DefaultTraversalKind) {
+ TraversalKind DefaultTraversalKind) {
std::vector<DynTypedMatcher> Matchers;
Matchers.reserve(Cases.size());
for (const auto &Case : Cases) {
diff --git a/clang/unittests/AST/ASTImporterTest.cpp b/clang/unittests/AST/ASTImporterTest.cpp
index 2c14244a2eaa..e81e5d028cd0 100644
--- a/clang/unittests/AST/ASTImporterTest.cpp
+++ b/clang/unittests/AST/ASTImporterTest.cpp
@@ -397,7 +397,7 @@ TEST_P(ImportExpr, ImportStmtExpr) {
testImport(
"void declToImport() { int b; int a = b ?: 1; int C = ({int X=4; X;}); }",
Lang_C99, "", Lang_C99, Verifier,
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
functionDecl(hasDescendant(varDecl(
hasName("C"), hasType(asString("int")),
hasInitializer(stmtExpr(
@@ -423,7 +423,7 @@ TEST_P(ImportExpr, ImportBinaryConditionalOperator) {
testImport(
"void declToImport() { (void)(1 ?: -5); }", Lang_CXX03, "", Lang_CXX03,
Verifier,
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
functionDecl(hasDescendant(binaryConditionalOperator(
hasCondition(implicitCastExpr(
hasSourceExpression(opaqueValueExpr(
@@ -502,7 +502,7 @@ TEST_P(ImportExpr, CXXTemporaryObjectExpr) {
"struct C {};"
"void declToImport() { C c = C(); }",
Lang_CXX03, "", Lang_CXX03, Verifier,
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
functionDecl(hasDescendant(exprWithCleanups(has(cxxConstructExpr(
has(materializeTemporaryExpr(has(implicitCastExpr(
has(cxxTemporaryObjectExpr()))))))))))));
@@ -552,7 +552,7 @@ TEST_P(ImportType, ImportTypeAliasTemplate) {
"template <int K> using dummy2 = dummy<K>;"
"int declToImport() { return dummy2<3>::i; }",
Lang_CXX11, "", Lang_CXX11, Verifier,
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
functionDecl(hasDescendant(implicitCastExpr(has(declRefExpr()))),
unless(hasAncestor(
translationUnitDecl(has(typeAliasDecl())))))));
@@ -583,9 +583,8 @@ TEST_P(ImportType, ImportPackExpansion) {
"};"
"int declToImport() { return dummy<int>::i; }",
Lang_CXX11, "", Lang_CXX11, Verifier,
- traverse(ast_type_traits::TK_AsIs,
- functionDecl(hasDescendant(returnStmt(
- has(implicitCastExpr(has(declRefExpr()))))))));
+ traverse(TK_AsIs, functionDecl(hasDescendant(returnStmt(has(
+ implicitCastExpr(has(declRefExpr()))))))));
}
const internal::VariadicDynCastAllOfMatcher<Type,
@@ -662,7 +661,7 @@ TEST_P(ImportExpr, ImportCXXTypeidExpr) {
"}",
Lang_CXX11, "", Lang_CXX11, Verifier,
traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
functionDecl(
hasDescendant(varDecl(hasName("a"), hasInitializer(hasDescendant(
cxxTypeidExpr())))),
diff --git a/clang/unittests/AST/ASTTypeTraitsTest.cpp b/clang/unittests/AST/ASTTypeTraitsTest.cpp
index 2313f9f6dfa2..998488f1f1f9 100644
--- a/clang/unittests/AST/ASTTypeTraitsTest.cpp
+++ b/clang/unittests/AST/ASTTypeTraitsTest.cpp
@@ -14,7 +14,7 @@
using namespace clang::ast_matchers;
namespace clang {
-namespace ast_type_traits {
+namespace {
TEST(ASTNodeKind, NoKind) {
EXPECT_FALSE(ASTNodeKind().isBaseOf(ASTNodeKind()));
@@ -179,5 +179,5 @@ TEST(DynTypedNode, QualType) {
EXPECT_FALSE(Node < Node);
}
-} // namespace ast_type_traits
+} // namespace
} // namespace clang
diff --git a/clang/unittests/AST/SourceLocationTest.cpp b/clang/unittests/AST/SourceLocationTest.cpp
index 32dc382aa05c..c1565c8f4c30 100644
--- a/clang/unittests/AST/SourceLocationTest.cpp
+++ b/clang/unittests/AST/SourceLocationTest.cpp
@@ -683,8 +683,7 @@ TEST(ObjCMessageExpr, ParenExprRange) {
"+ (void) f1: (A)arg;\n"
"@end\n"
"void f2() { A a; [B f1: (a)]; }\n",
- traverse(ast_type_traits::TK_AsIs, parenExpr()),
- Lang_OBJCXX));
+ traverse(TK_AsIs, parenExpr()), Lang_OBJCXX));
}
TEST(FunctionDecl, FunctionDeclWithThrowSpecification) {
diff --git a/clang/unittests/AST/StmtPrinterTest.cpp b/clang/unittests/AST/StmtPrinterTest.cpp
index c464b9e9f51a..29cdbf75a00c 100644
--- a/clang/unittests/AST/StmtPrinterTest.cpp
+++ b/clang/unittests/AST/StmtPrinterTest.cpp
@@ -129,19 +129,17 @@ TEST(StmtPrinter, TestFloatingPointLiteral) {
}
TEST(StmtPrinter, TestCXXConversionDeclImplicit) {
- ASSERT_TRUE(
- PrintedStmtCXXMatches(StdVer::CXX98,
- "struct A {"
- "operator void *();"
- "A operator&(A);"
- "};"
- "void bar(void *);"
- "void foo(A a, A b) {"
- " bar(a & b);"
- "}",
- traverse(ast_type_traits::TK_AsIs,
- cxxMemberCallExpr(anything()).bind("id")),
- "a & b"));
+ ASSERT_TRUE(PrintedStmtCXXMatches(
+ StdVer::CXX98,
+ "struct A {"
+ "operator void *();"
+ "A operator&(A);"
+ "};"
+ "void bar(void *);"
+ "void foo(A a, A b) {"
+ " bar(a & b);"
+ "}",
+ traverse(TK_AsIs, cxxMemberCallExpr(anything()).bind("id")), "a & b"));
}
TEST(StmtPrinter, TestCXXConversionDeclExplicit) {
diff --git a/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
index 61dc1a9ee939..ef9d62277f27 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
@@ -314,16 +314,15 @@ TEST_P(ASTMatchersTest, Unless) {
TEST_P(ASTMatchersTest, HasCastKind) {
EXPECT_TRUE(
matches("char *p = 0;",
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
varDecl(has(castExpr(hasCastKind(CK_NullToPointer)))))));
EXPECT_TRUE(notMatches(
"char *p = 0;",
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
varDecl(has(castExpr(hasCastKind(CK_DerivedToBase)))))));
- EXPECT_TRUE(matches(
- "char *p = 0;",
- traverse(ast_type_traits::TK_AsIs,
- varDecl(has(implicitCastExpr(hasCastKind(CK_NullToPointer)))))));
+ EXPECT_TRUE(matches("char *p = 0;",
+ traverse(TK_AsIs, varDecl(has(implicitCastExpr(
+ hasCastKind(CK_NullToPointer)))))));
}
TEST_P(ASTMatchersTest, HasDescendant) {
@@ -1588,7 +1587,7 @@ TEST_P(ASTMatchersTest, HasArgument_CXXConstructorDecl) {
}
auto Constructor = traverse(
- ast_type_traits::TK_AsIs,
+ TK_AsIs,
cxxConstructExpr(hasArgument(0, declRefExpr(to(varDecl(hasName("y")))))));
EXPECT_TRUE(matches(
@@ -1603,9 +1602,8 @@ TEST_P(ASTMatchersTest, HasArgument_CXXConstructorDecl) {
"class X { public: X(int); }; void x() { int z; X x(z); }", Constructor));
StatementMatcher WrongIndex =
- traverse(ast_type_traits::TK_AsIs,
- cxxConstructExpr(
- hasArgument(42, declRefExpr(to(varDecl(hasName("y")))))));
+ traverse(TK_AsIs, cxxConstructExpr(hasArgument(
+ 42, declRefExpr(to(varDecl(hasName("y")))))));
EXPECT_TRUE(notMatches(
"class X { public: X(int); }; void x() { int y; X x(y); }", WrongIndex));
}
@@ -1616,7 +1614,7 @@ TEST_P(ASTMatchersTest, ArgumentCountIs_CXXConstructExpr) {
}
auto Constructor1Arg =
- traverse(ast_type_traits::TK_AsIs, cxxConstructExpr(argumentCountIs(1)));
+ traverse(TK_AsIs, cxxConstructExpr(argumentCountIs(1)));
EXPECT_TRUE(matches("class X { public: X(int); }; void x() { X x(0); }",
Constructor1Arg));
@@ -1744,8 +1742,7 @@ TEST_P(ASTMatchersTest, IsListInitialization) {
}
auto ConstructorListInit =
- traverse(ast_type_traits::TK_AsIs,
- varDecl(has(cxxConstructExpr(isListInitialization()))));
+ traverse(TK_AsIs, varDecl(has(cxxConstructExpr(isListInitialization()))));
EXPECT_TRUE(matches("class X { public: X(int); }; void x() { X x{0}; }",
ConstructorListInit));
diff --git a/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
index f4e929752ea0..7ce17ce95621 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
@@ -476,9 +476,8 @@ TEST_P(ASTMatchersTest, ThisPointerType) {
return;
}
- StatementMatcher MethodOnY =
- traverse(ast_type_traits::TK_AsIs,
- cxxMemberCallExpr(thisPointerType(recordDecl(hasName("Y")))));
+ StatementMatcher MethodOnY = traverse(
+ TK_AsIs, cxxMemberCallExpr(thisPointerType(recordDecl(hasName("Y")))));
EXPECT_TRUE(matches("class Y { public: void x(); }; void z() { Y y; y.x(); }",
MethodOnY));
@@ -741,8 +740,7 @@ TEST_P(ASTMatchersTest, Matcher_ConstructorCall) {
return;
}
- StatementMatcher Constructor =
- traverse(ast_type_traits::TK_AsIs, cxxConstructExpr());
+ StatementMatcher Constructor = traverse(TK_AsIs, cxxConstructExpr());
EXPECT_TRUE(
matches("class X { public: X(); }; void x() { X x; }", Constructor));
@@ -776,8 +774,7 @@ TEST_P(ASTMatchersTest, Matcher_BindTemporaryExpression) {
return;
}
- StatementMatcher TempExpression =
- traverse(ast_type_traits::TK_AsIs, cxxBindTemporaryExpr());
+ StatementMatcher TempExpression = traverse(TK_AsIs, cxxBindTemporaryExpr());
StringRef ClassString = "class string { public: string(); ~string(); }; ";
@@ -810,7 +807,7 @@ TEST_P(ASTMatchersTest, MaterializeTemporaryExpr_MatchesTemporaryCXX11CXX14) {
}
StatementMatcher TempExpression =
- traverse(ast_type_traits::TK_AsIs, materializeTemporaryExpr());
+ traverse(TK_AsIs, materializeTemporaryExpr());
EXPECT_TRUE(matches("class string { public: string(); }; "
"string GetStringByValue();"
@@ -826,7 +823,7 @@ TEST_P(ASTMatchersTest, MaterializeTemporaryExpr_MatchesTemporary) {
StringRef ClassString = "class string { public: string(); int length(); }; ";
StatementMatcher TempExpression =
- traverse(ast_type_traits::TK_AsIs, materializeTemporaryExpr());
+ traverse(TK_AsIs, materializeTemporaryExpr());
EXPECT_TRUE(notMatches(ClassString +
"string* GetStringPointer(); "
@@ -1104,9 +1101,8 @@ TEST_P(ASTMatchersTest, BinaryConditionalOperator) {
return;
}
- StatementMatcher AlwaysOne =
- traverse(ast_type_traits::TK_AsIs,
- binaryConditionalOperator(
+ StatementMatcher AlwaysOne = traverse(
+ TK_AsIs, binaryConditionalOperator(
hasCondition(implicitCastExpr(has(opaqueValueExpr(
hasSourceExpression((integerLiteral(equals(1)))))))),
hasFalseExpression(integerLiteral(equals(0)))));
@@ -1179,11 +1175,10 @@ TEST_P(ASTMatchersTest, CastExpr_MatchesExplicitCasts_CXX) {
TEST_P(ASTMatchersTest, CastExpression_MatchesImplicitCasts) {
// This test creates an implicit cast from int to char.
- EXPECT_TRUE(
- matches("char c = 0;", traverse(ast_type_traits::TK_AsIs, castExpr())));
+ EXPECT_TRUE(matches("char c = 0;", traverse(TK_AsIs, castExpr())));
// This test creates an implicit cast from lvalue to rvalue.
EXPECT_TRUE(matches("void f() { char c = 0, d = c; }",
- traverse(ast_type_traits::TK_AsIs, castExpr())));
+ traverse(TK_AsIs, castExpr())));
}
TEST_P(ASTMatchersTest, CastExpr_DoesNotMatchNonCasts) {
@@ -1299,17 +1294,17 @@ TEST_P(ASTMatchersTest, CStyleCastExpr_DoesNotMatchOtherCasts) {
TEST_P(ASTMatchersTest, ImplicitCastExpr_MatchesSimpleCase) {
// This test creates an implicit const cast.
- EXPECT_TRUE(matches("void f() { int x = 0; const int y = x; }",
- traverse(ast_type_traits::TK_AsIs,
- varDecl(hasInitializer(implicitCastExpr())))));
+ EXPECT_TRUE(
+ matches("void f() { int x = 0; const int y = x; }",
+ traverse(TK_AsIs, varDecl(hasInitializer(implicitCastExpr())))));
// This test creates an implicit cast from int to char.
- EXPECT_TRUE(matches("char c = 0;",
- traverse(ast_type_traits::TK_AsIs,
- varDecl(hasInitializer(implicitCastExpr())))));
+ EXPECT_TRUE(
+ matches("char c = 0;",
+ traverse(TK_AsIs, varDecl(hasInitializer(implicitCastExpr())))));
// This test creates an implicit array-to-pointer cast.
- EXPECT_TRUE(matches("int arr[6]; int *p = arr;",
- traverse(ast_type_traits::TK_AsIs,
- varDecl(hasInitializer(implicitCastExpr())))));
+ EXPECT_TRUE(
+ matches("int arr[6]; int *p = arr;",
+ traverse(TK_AsIs, varDecl(hasInitializer(implicitCastExpr())))));
}
TEST_P(ASTMatchersTest, ImplicitCastExpr_DoesNotMatchIncorrectly) {
@@ -1355,14 +1350,14 @@ TEST_P(ASTMatchersTest, ExprWithCleanups_MatchesExprWithCleanups) {
if (!GetParam().isCXX()) {
return;
}
- EXPECT_TRUE(matches("struct Foo { ~Foo(); };"
- "const Foo f = Foo();",
- traverse(ast_type_traits::TK_AsIs,
- varDecl(hasInitializer(exprWithCleanups())))));
- EXPECT_FALSE(matches("struct Foo { }; Foo a;"
- "const Foo f = a;",
- traverse(ast_type_traits::TK_AsIs,
- varDecl(hasInitializer(exprWithCleanups())))));
+ EXPECT_TRUE(
+ matches("struct Foo { ~Foo(); };"
+ "const Foo f = Foo();",
+ traverse(TK_AsIs, varDecl(hasInitializer(exprWithCleanups())))));
+ EXPECT_FALSE(
+ matches("struct Foo { }; Foo a;"
+ "const Foo f = a;",
+ traverse(TK_AsIs, varDecl(hasInitializer(exprWithCleanups())))));
}
TEST_P(ASTMatchersTest, InitListExpr) {
@@ -1397,18 +1392,16 @@ TEST_P(ASTMatchersTest,
"struct A {"
" A(std::initializer_list<int>) {}"
"};";
- EXPECT_TRUE(
- matches(code + "A a{0};",
- traverse(ast_type_traits::TK_AsIs,
- cxxConstructExpr(has(cxxStdInitializerListExpr()),
- hasDeclaration(cxxConstructorDecl(
- ofClass(hasName("A"))))))));
- EXPECT_TRUE(
- matches(code + "A a = {0};",
- traverse(ast_type_traits::TK_AsIs,
- cxxConstructExpr(has(cxxStdInitializerListExpr()),
- hasDeclaration(cxxConstructorDecl(
- ofClass(hasName("A"))))))));
+ EXPECT_TRUE(matches(
+ code + "A a{0};",
+ traverse(TK_AsIs, cxxConstructExpr(has(cxxStdInitializerListExpr()),
+ hasDeclaration(cxxConstructorDecl(
+ ofClass(hasName("A"))))))));
+ EXPECT_TRUE(matches(
+ code + "A a = {0};",
+ traverse(TK_AsIs, cxxConstructExpr(has(cxxStdInitializerListExpr()),
+ hasDeclaration(cxxConstructorDecl(
+ ofClass(hasName("A"))))))));
EXPECT_TRUE(notMatches("int a[] = { 1, 2 };", cxxStdInitializerListExpr()));
EXPECT_TRUE(notMatches("struct B { int x, y; }; B b = { 5, 6 };",
@@ -1492,25 +1485,21 @@ TEST_P(ASTMatchersTest, CxxExceptionHandling_SimpleCases) {
}
TEST_P(ASTMatchersTest, ParenExpr_SimpleCases) {
- EXPECT_TRUE(
- matches("int i = (3);", traverse(ast_type_traits::TK_AsIs, parenExpr())));
- EXPECT_TRUE(matches("int i = (3 + 7);",
- traverse(ast_type_traits::TK_AsIs, parenExpr())));
- EXPECT_TRUE(notMatches("int i = 3;",
- traverse(ast_type_traits::TK_AsIs, parenExpr())));
+ EXPECT_TRUE(matches("int i = (3);", traverse(TK_AsIs, parenExpr())));
+ EXPECT_TRUE(matches("int i = (3 + 7);", traverse(TK_AsIs, parenExpr())));
+ EXPECT_TRUE(notMatches("int i = 3;", traverse(TK_AsIs, parenExpr())));
EXPECT_TRUE(notMatches("int f() { return 1; }; void g() { int a = f(); }",
- traverse(ast_type_traits::TK_AsIs, parenExpr())));
+ traverse(TK_AsIs, parenExpr())));
}
TEST_P(ASTMatchersTest, IgnoringParens) {
- EXPECT_FALSE(matches(
- "const char* str = (\"my-string\");",
- traverse(ast_type_traits::TK_AsIs,
- implicitCastExpr(hasSourceExpression(stringLiteral())))));
- EXPECT_TRUE(matches("const char* str = (\"my-string\");",
- traverse(ast_type_traits::TK_AsIs,
- implicitCastExpr(hasSourceExpression(
- ignoringParens(stringLiteral()))))));
+ EXPECT_FALSE(matches("const char* str = (\"my-string\");",
+ traverse(TK_AsIs, implicitCastExpr(hasSourceExpression(
+ stringLiteral())))));
+ EXPECT_TRUE(
+ matches("const char* str = (\"my-string\");",
+ traverse(TK_AsIs, implicitCastExpr(hasSourceExpression(
+ ignoringParens(stringLiteral()))))));
}
TEST_P(ASTMatchersTest, QualType) {
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
index b0ec1719daaf..6f1ed0491ba1 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
@@ -373,8 +373,7 @@ TEST(Callee, MatchesDeclarations) {
EXPECT_TRUE(matches("class Y { void x() { x(); } };", CallMethodX));
EXPECT_TRUE(notMatches("class Y { void x() {} };", CallMethodX));
- CallMethodX =
- traverse(ast_type_traits::TK_AsIs, callExpr(callee(cxxConversionDecl())));
+ CallMethodX = traverse(TK_AsIs, callExpr(callee(cxxConversionDecl())));
EXPECT_TRUE(
matches("struct Y { operator int() const; }; int i = Y();", CallMethodX));
EXPECT_TRUE(notMatches("struct Y { operator int() const; }; Y y = Y();",
@@ -436,8 +435,8 @@ TEST(Matcher, AnyArgument) {
"void x() { int y; (void)Y(1, 2); }",
UnresolvedCtorArgumentY));
- StatementMatcher ImplicitCastedArgument = traverse(
- ast_type_traits::TK_AsIs, callExpr(hasAnyArgument(implicitCastExpr())));
+ StatementMatcher ImplicitCastedArgument =
+ traverse(TK_AsIs, callExpr(hasAnyArgument(implicitCastExpr())));
EXPECT_TRUE(matches("void x(long) { int y; x(y); }", ImplicitCastedArgument));
}
@@ -591,15 +590,13 @@ TEST(MatcherCXXMemberCallExpr, OnImplicitObjectArgument) {
struct X : public Y {};
void z(X x) { x.m(); }
)cc";
- auto MatchesY = traverse(ast_type_traits::TK_AsIs,
- cxxMemberCallExpr(onImplicitObjectArgument(
- hasType(cxxRecordDecl(hasName("Y"))))));
+ auto MatchesY = traverse(TK_AsIs, cxxMemberCallExpr(onImplicitObjectArgument(
+ hasType(cxxRecordDecl(hasName("Y"))))));
EXPECT_TRUE(matches(Snippet1, MatchesY));
EXPECT_TRUE(matches(Snippet2, MatchesY));
- auto MatchesX = traverse(ast_type_traits::TK_AsIs,
- cxxMemberCallExpr(onImplicitObjectArgument(
- hasType(cxxRecordDecl(hasName("X"))))));
+ auto MatchesX = traverse(TK_AsIs, cxxMemberCallExpr(onImplicitObjectArgument(
+ hasType(cxxRecordDecl(hasName("X"))))));
EXPECT_TRUE(notMatches(Snippet2, MatchesX));
// Parens are not ignored.
@@ -610,9 +607,8 @@ TEST(MatcherCXXMemberCallExpr, OnImplicitObjectArgument) {
Y g();
void z(Y y) { (g()).m(); }
)cc";
- auto MatchesCall =
- traverse(ast_type_traits::TK_AsIs,
- cxxMemberCallExpr(onImplicitObjectArgument(callExpr())));
+ auto MatchesCall = traverse(
+ TK_AsIs, cxxMemberCallExpr(onImplicitObjectArgument(callExpr())));
EXPECT_TRUE(notMatches(Snippet3, MatchesCall));
}
@@ -710,9 +706,8 @@ TEST(ForEachArgumentWithParam, MatchesConstructExpr) {
StatementMatcher ArgumentY =
declRefExpr(to(varDecl(hasName("y")))).bind("arg");
DeclarationMatcher IntParam = parmVarDecl(hasType(isInteger())).bind("param");
- StatementMatcher ConstructExpr =
- traverse(ast_type_traits::TK_AsIs,
- cxxConstructExpr(forEachArgumentWithParam(ArgumentY, IntParam)));
+ StatementMatcher ConstructExpr = traverse(
+ TK_AsIs, cxxConstructExpr(forEachArgumentWithParam(ArgumentY, IntParam)));
EXPECT_TRUE(matchAndVerifyResultTrue(
"struct C {"
@@ -1313,10 +1308,9 @@ TEST(MatchBinaryOperator, HasLHSAndHasRHS) {
EXPECT_TRUE(matches("void x() { true && false; }", OperatorTrueFalse));
EXPECT_TRUE(notMatches("void x() { false || true; }", OperatorTrueFalse));
- StatementMatcher OperatorIntPointer =
- arraySubscriptExpr(hasLHS(hasType(isInteger())),
- traverse(ast_type_traits::TK_AsIs,
- hasRHS(hasType(pointsTo(qualType())))));
+ StatementMatcher OperatorIntPointer = arraySubscriptExpr(
+ hasLHS(hasType(isInteger())),
+ traverse(TK_AsIs, hasRHS(hasType(pointsTo(qualType())))));
EXPECT_TRUE(matches("void x() { 1[\"abc\"]; }", OperatorIntPointer));
EXPECT_TRUE(notMatches("void x() { \"abc\"[1]; }", OperatorIntPointer));
}
@@ -1517,10 +1511,10 @@ TEST(ArraySubscriptMatchers, ArrayIndex) {
}
TEST(ArraySubscriptMatchers, MatchesArrayBase) {
- EXPECT_TRUE(matches("int i[2]; void f() { i[1] = 2; }",
- traverse(ast_type_traits::TK_AsIs,
- arraySubscriptExpr(hasBase(implicitCastExpr(
- hasSourceExpression(declRefExpr())))))));
+ EXPECT_TRUE(
+ matches("int i[2]; void f() { i[1] = 2; }",
+ traverse(TK_AsIs, arraySubscriptExpr(hasBase(implicitCastExpr(
+ hasSourceExpression(declRefExpr())))))));
}
TEST(Matcher, OfClass) {
@@ -1708,13 +1702,13 @@ TEST(HasImplicitDestinationType, MatchesSimpleCase) {
// This test creates an implicit const cast.
EXPECT_TRUE(matches(
"int x; const int i = x;",
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
implicitCastExpr(hasImplicitDestinationType(isInteger())))));
// This test creates an implicit array-to-pointer cast.
- EXPECT_TRUE(matches("int arr[3]; int *p = arr;",
- traverse(ast_type_traits::TK_AsIs,
- implicitCastExpr(hasImplicitDestinationType(
- pointsTo(TypeMatcher(anything())))))));
+ EXPECT_TRUE(
+ matches("int arr[3]; int *p = arr;",
+ traverse(TK_AsIs, implicitCastExpr(hasImplicitDestinationType(
+ pointsTo(TypeMatcher(anything())))))));
}
TEST(HasImplicitDestinationType, DoesNotMatchIncorrectly) {
@@ -1848,7 +1842,7 @@ int main()
)";
EXPECT_TRUE(matches(
Code,
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
varDecl(hasName("i"),
hasInitializer(exprWithCleanups(has(cxxConstructExpr(
has(expr(ignoringImplicit(cxxConstructExpr(has(
@@ -1856,9 +1850,8 @@ int main()
}
TEST(IgnoringImplicit, DoesNotMatchIncorrectly) {
- EXPECT_TRUE(notMatches(
- "class C {}; C a = C();",
- traverse(ast_type_traits::TK_AsIs, varDecl(has(cxxConstructExpr())))));
+ EXPECT_TRUE(notMatches("class C {}; C a = C();",
+ traverse(TK_AsIs, varDecl(has(cxxConstructExpr())))));
}
TEST(Traversal, traverseMatcher) {
@@ -3068,7 +3061,7 @@ TEST(IgnoringImpCasts, DoesNotMatchIncorrectly) {
integerLiteral())))));
EXPECT_TRUE(notMatches(
"int i = (0);",
- traverse(ast_type_traits::TK_AsIs,
+ traverse(TK_AsIs,
varDecl(hasInitializer(ignoringImpCasts(integerLiteral()))))));
EXPECT_TRUE(notMatches("float i = (float)0;",
varDecl(hasInitializer(ignoringImpCasts(
@@ -3181,18 +3174,17 @@ TEST(IgnoringParenAndImpCasts, DoesNotMatchIncorrectly) {
}
TEST(HasSourceExpression, MatchesImplicitCasts) {
- EXPECT_TRUE(matches(
- "class string {}; class URL { public: URL(string s); };"
- "void r() {string a_string; URL url = a_string; }",
- traverse(ast_type_traits::TK_AsIs,
- implicitCastExpr(hasSourceExpression(cxxConstructExpr())))));
+ EXPECT_TRUE(matches("class string {}; class URL { public: URL(string s); };"
+ "void r() {string a_string; URL url = a_string; }",
+ traverse(TK_AsIs, implicitCastExpr(hasSourceExpression(
+ cxxConstructExpr())))));
}
TEST(HasSourceExpression, MatchesExplicitCasts) {
- EXPECT_TRUE(matches("float x = static_cast<float>(42);",
- traverse(ast_type_traits::TK_AsIs,
- explicitCastExpr(hasSourceExpression(
- hasDescendant(expr(integerLiteral())))))));
+ EXPECT_TRUE(
+ matches("float x = static_cast<float>(42);",
+ traverse(TK_AsIs, explicitCastExpr(hasSourceExpression(
+ hasDescendant(expr(integerLiteral())))))));
}
TEST(UsingDeclaration, MatchesSpecificTarget) {
@@ -3246,21 +3238,18 @@ TEST(SwitchCase, MatchesEachCase) {
EXPECT_TRUE(notMatches(
"void x() { if (1) switch(42) { case 42: switch (42) { default:; } } }",
ifStmt(has(switchStmt(forEachSwitchCase(defaultStmt()))))));
- EXPECT_TRUE(
- matches("void x() { switch(42) { case 1+1: case 4:; } }",
- traverse(ast_type_traits::TK_AsIs,
- switchStmt(forEachSwitchCase(caseStmt(hasCaseConstant(
- constantExpr(has(integerLiteral())))))))));
- EXPECT_TRUE(
- notMatches("void x() { switch(42) { case 1+1: case 2+2:; } }",
- traverse(ast_type_traits::TK_AsIs,
- switchStmt(forEachSwitchCase(caseStmt(hasCaseConstant(
- constantExpr(has(integerLiteral())))))))));
- EXPECT_TRUE(
- notMatches("void x() { switch(42) { case 1 ... 2:; } }",
- traverse(ast_type_traits::TK_AsIs,
- switchStmt(forEachSwitchCase(caseStmt(hasCaseConstant(
- constantExpr(has(integerLiteral())))))))));
+ EXPECT_TRUE(matches(
+ "void x() { switch(42) { case 1+1: case 4:; } }",
+ traverse(TK_AsIs, switchStmt(forEachSwitchCase(caseStmt(hasCaseConstant(
+ constantExpr(has(integerLiteral())))))))));
+ EXPECT_TRUE(notMatches(
+ "void x() { switch(42) { case 1+1: case 2+2:; } }",
+ traverse(TK_AsIs, switchStmt(forEachSwitchCase(caseStmt(hasCaseConstant(
+ constantExpr(has(integerLiteral())))))))));
+ EXPECT_TRUE(notMatches(
+ "void x() { switch(42) { case 1 ... 2:; } }",
+ traverse(TK_AsIs, switchStmt(forEachSwitchCase(caseStmt(hasCaseConstant(
+ constantExpr(has(integerLiteral())))))))));
EXPECT_TRUE(matchAndVerifyResultTrue(
"void x() { switch (42) { case 1: case 2: case 3: default:; } }",
switchStmt(forEachSwitchCase(caseStmt().bind("x"))),
@@ -3282,50 +3271,49 @@ TEST(Declaration, HasExplicitSpecifier) {
cxxConversionDecl(
hasExplicitSpecifier(constantExpr(has(cxxBoolLiteral())))),
langCxx20OrLater()));
- EXPECT_TRUE(matches("struct S { explicit(true) operator int(); };",
- traverse(ast_type_traits::TK_AsIs,
- cxxConversionDecl(hasExplicitSpecifier(
- constantExpr(has(cxxBoolLiteral()))))),
- langCxx20OrLater()));
- EXPECT_TRUE(matches("struct S { explicit(false) operator int(); };",
- traverse(ast_type_traits::TK_AsIs,
- cxxConversionDecl(hasExplicitSpecifier(
- constantExpr(has(cxxBoolLiteral()))))),
- langCxx20OrLater()));
- EXPECT_TRUE(notMatches("template<bool b> struct S { explicit(b) S(int); };",
- traverse(ast_type_traits::TK_AsIs,
- cxxConstructorDecl(hasExplicitSpecifier(
- constantExpr(has(cxxBoolLiteral()))))),
- langCxx20OrLater()));
- EXPECT_TRUE(matches("struct S { explicit(true) S(int); };",
- traverse(ast_type_traits::TK_AsIs,
- cxxConstructorDecl(hasExplicitSpecifier(
- constantExpr(has(cxxBoolLiteral()))))),
- langCxx20OrLater()));
- EXPECT_TRUE(matches("struct S { explicit(false) S(int); };",
- traverse(ast_type_traits::TK_AsIs,
- cxxConstructorDecl(hasExplicitSpecifier(
- constantExpr(has(cxxBoolLiteral()))))),
- langCxx20OrLater()));
+ EXPECT_TRUE(
+ matches("struct S { explicit(true) operator int(); };",
+ traverse(TK_AsIs, cxxConversionDecl(hasExplicitSpecifier(
+ constantExpr(has(cxxBoolLiteral()))))),
+ langCxx20OrLater()));
+ EXPECT_TRUE(
+ matches("struct S { explicit(false) operator int(); };",
+ traverse(TK_AsIs, cxxConversionDecl(hasExplicitSpecifier(
+ constantExpr(has(cxxBoolLiteral()))))),
+ langCxx20OrLater()));
+ EXPECT_TRUE(
+ notMatches("template<bool b> struct S { explicit(b) S(int); };",
+ traverse(TK_AsIs, cxxConstructorDecl(hasExplicitSpecifier(
+ constantExpr(has(cxxBoolLiteral()))))),
+ langCxx20OrLater()));
+ EXPECT_TRUE(
+ matches("struct S { explicit(true) S(int); };",
+ traverse(TK_AsIs, cxxConstructorDecl(hasExplicitSpecifier(
+ constantExpr(has(cxxBoolLiteral()))))),
+ langCxx20OrLater()));
+ EXPECT_TRUE(
+ matches("struct S { explicit(false) S(int); };",
+ traverse(TK_AsIs, cxxConstructorDecl(hasExplicitSpecifier(
+ constantExpr(has(cxxBoolLiteral()))))),
+ langCxx20OrLater()));
EXPECT_TRUE(
notMatches("template<typename T> struct S { S(int); };"
"template<bool b = true> explicit(b) S(int) -> S<int>;",
- traverse(ast_type_traits::TK_AsIs,
- cxxDeductionGuideDecl(hasExplicitSpecifier(
- constantExpr(has(cxxBoolLiteral()))))),
+ traverse(TK_AsIs, cxxDeductionGuideDecl(hasExplicitSpecifier(
+ constantExpr(has(cxxBoolLiteral()))))),
langCxx20OrLater()));
- EXPECT_TRUE(matches("template<typename T> struct S { S(int); };"
- "explicit(true) S(int) -> S<int>;",
- traverse(ast_type_traits::TK_AsIs,
- cxxDeductionGuideDecl(hasExplicitSpecifier(
- constantExpr(has(cxxBoolLiteral()))))),
- langCxx20OrLater()));
- EXPECT_TRUE(matches("template<typename T> struct S { S(int); };"
- "explicit(false) S(int) -> S<int>;",
- traverse(ast_type_traits::TK_AsIs,
- cxxDeductionGuideDecl(hasExplicitSpecifier(
- constantExpr(has(cxxBoolLiteral()))))),
- langCxx20OrLater()));
+ EXPECT_TRUE(
+ matches("template<typename T> struct S { S(int); };"
+ "explicit(true) S(int) -> S<int>;",
+ traverse(TK_AsIs, cxxDeductionGuideDecl(hasExplicitSpecifier(
+ constantExpr(has(cxxBoolLiteral()))))),
+ langCxx20OrLater()));
+ EXPECT_TRUE(
+ matches("template<typename T> struct S { S(int); };"
+ "explicit(false) S(int) -> S<int>;",
+ traverse(TK_AsIs, cxxDeductionGuideDecl(hasExplicitSpecifier(
+ constantExpr(has(cxxBoolLiteral()))))),
+ langCxx20OrLater()));
}
TEST(ForEachConstructorInitializer, MatchesInitializers) {
diff --git a/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp b/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
index 01ee3da64003..7d6c51f965ec 100644
--- a/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
+++ b/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
@@ -507,10 +507,8 @@ TEST_F(RegistryTest, HasArgs) {
TEST_F(RegistryTest, ParenExpr) {
Matcher<Stmt> Value = constructMatcher("parenExpr").getTypedMatcher<Stmt>();
- EXPECT_TRUE(
- matches("int i = (1);", traverse(ast_type_traits::TK_AsIs, Value)));
- EXPECT_FALSE(
- matches("int i = 1;", traverse(ast_type_traits::TK_AsIs, Value)));
+ EXPECT_TRUE(matches("int i = (1);", traverse(TK_AsIs, Value)));
+ EXPECT_FALSE(matches("int i = 1;", traverse(TK_AsIs, Value)));
}
TEST_F(RegistryTest, EqualsMatcher) {
diff --git a/clang/unittests/Analysis/ExprMutationAnalyzerTest.cpp b/clang/unittests/Analysis/ExprMutationAnalyzerTest.cpp
index 31cb7ed33dab..a968d292b53f 100644
--- a/clang/unittests/Analysis/ExprMutationAnalyzerTest.cpp
+++ b/clang/unittests/Analysis/ExprMutationAnalyzerTest.cpp
@@ -53,7 +53,7 @@ StmtMatcher withEnclosingCompound(ExprMatcher Matcher) {
bool isMutated(const SmallVectorImpl<BoundNodes> &Results, ASTUnit *AST) {
const auto *const S = selectFirst<Stmt>("stmt", Results);
const auto *const E = selectFirst<Expr>("expr", Results);
- TraversalKindScope RAII(AST->getASTContext(), ast_type_traits::TK_AsIs);
+ TraversalKindScope RAII(AST->getASTContext(), TK_AsIs);
return ExprMutationAnalyzer(*S, AST->getASTContext()).isMutated(E);
}
diff --git a/clang/unittests/Tooling/RangeSelectorTest.cpp b/clang/unittests/Tooling/RangeSelectorTest.cpp
index 499c9a8cc666..0dded6963ee1 100644
--- a/clang/unittests/Tooling/RangeSelectorTest.cpp
+++ b/clang/unittests/Tooling/RangeSelectorTest.cpp
@@ -47,7 +47,7 @@ template <typename M> TestMatch matchCode(StringRef Code, M Matcher) {
ASTContext &Context = ASTUnit->getASTContext();
assert(!Context.getDiagnostics().hasErrorOccurred() && "Compilation error");
- TraversalKindScope RAII(Context, ast_type_traits::TK_AsIs);
+ TraversalKindScope RAII(Context, TK_AsIs);
auto Matches = ast_matchers::match(Matcher, Context);
// We expect a single, exact match.
assert(Matches.size() != 0 && "no matches found");
diff --git a/clang/unittests/Tooling/RefactoringCallbacksTest.cpp b/clang/unittests/Tooling/RefactoringCallbacksTest.cpp
index 5894d6836883..47c1c11ac9fc 100644
--- a/clang/unittests/Tooling/RefactoringCallbacksTest.cpp
+++ b/clang/unittests/Tooling/RefactoringCallbacksTest.cpp
@@ -22,7 +22,7 @@ void expectRewritten(const std::string &Code, const std::string &Expected,
const T &AMatcher, RefactoringCallback &Callback) {
std::map<std::string, Replacements> FileToReplace;
ASTMatchRefactorer Finder(FileToReplace);
- Finder.addMatcher(traverse(ast_type_traits::TK_AsIs, AMatcher), &Callback);
+ Finder.addMatcher(traverse(TK_AsIs, AMatcher), &Callback);
std::unique_ptr<tooling::FrontendActionFactory> Factory(
tooling::newFrontendActionFactory(&Finder));
ASSERT_TRUE(tooling::runToolOnCode(Factory->create(), Code))
@@ -147,6 +147,5 @@ TEST(RefactoringCallbacksTest, TemplateUnknownDollar) {
Callback.takeError());
}
-
-} // end namespace ast_matchers
+} // namespace tooling
} // end namespace clang
diff --git a/clang/unittests/Tooling/StencilTest.cpp b/clang/unittests/Tooling/StencilTest.cpp
index 56e81431e558..b270e9d2f572 100644
--- a/clang/unittests/Tooling/StencilTest.cpp
+++ b/clang/unittests/Tooling/StencilTest.cpp
@@ -338,8 +338,8 @@ TEST_F(StencilTest, AccessOpExplicitThis) {
};
)cc";
auto StmtMatch = matchStmt(
- Snippet, traverse(ast_type_traits::TK_AsIs,
- returnStmt(hasReturnValue(ignoringImplicit(memberExpr(
+ Snippet,
+ traverse(TK_AsIs, returnStmt(hasReturnValue(ignoringImplicit(memberExpr(
hasObjectExpression(expr().bind("obj"))))))));
ASSERT_TRUE(StmtMatch);
const Stencil Stencil = access("obj", "field");
More information about the llvm-branch-commits
mailing list