Set traversal explicitly where needed in clang-tidy
Reviewers: aaron.ballman
Subscribers: nemanjai, kbarton, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D72530
diff --git a/clang-tools-extra/clang-tidy/bugprone/UnhandledSelfAssignmentCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/UnhandledSelfAssignmentCheck.cpp
index d91353e..1f1158f 100644
--- a/clang-tools-extra/clang-tidy/bugprone/UnhandledSelfAssignmentCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/UnhandledSelfAssignmentCheck.cpp
@@ -52,8 +52,9 @@
// In the non-template case, we can search for the copy constructor call.
const auto HasNonTemplateSelfCopy = cxxMethodDecl(
ofClass(cxxRecordDecl(unless(hasAncestor(classTemplateDecl())))),
- hasDescendant(cxxConstructExpr(hasDeclaration(cxxConstructorDecl(
- isCopyConstructor(), ofClass(equalsBoundNode("class")))))));
+ traverse(ast_type_traits::TK_AsIs,
+ hasDescendant(cxxConstructExpr(hasDeclaration(cxxConstructorDecl(
+ isCopyConstructor(), ofClass(equalsBoundNode("class"))))))));
// In the template case, we need to handle two separate cases: 1) a local
// variable is created with the copy, 2) copy is created only as a temporary