From d0b982ca5cf685af08d5015e8c2dfae3ecab1a0b Mon Sep 17 00:00:00 2001 From: Craig Silverstein Date: Fri, 2 Jul 2010 19:07:50 +0000 Subject: [PATCH] Don't visit implicitly defined functions (default constructors and the like). Our goal with this visitor is to visit exactly what people type. Reviewed by chandlerc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107497 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/RecursiveASTVisitor.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/clang/AST/RecursiveASTVisitor.h b/include/clang/AST/RecursiveASTVisitor.h index d593be81f9..e0a2a015d4 100644 --- a/include/clang/AST/RecursiveASTVisitor.h +++ b/include/clang/AST/RecursiveASTVisitor.h @@ -386,6 +386,12 @@ bool RecursiveASTVisitor::TraverseDecl(Decl *D) { if (!D) return true; + // As a syntax visitor, we want to ignore declarations for + // implicitly-defined declarations (ones not typed explicitly by the + // user). + if (D->isImplicit()) + return true; + switch (D->getKind()) { #define ABSTRACT_DECL(DECL) #define DECL(CLASS, BASE) \ @@ -883,9 +889,6 @@ DEF_TRAVERSE_DECL(RecordDecl, { }) DEF_TRAVERSE_DECL(CXXRecordDecl, { - // FIXME: don't traverse compiler-generated constructor, - // destructor, and operator=, as they aren't written in the source - // code. TRY_TO(TraverseCXXRecordHelper(D)); }) -- 2.40.0