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
diff --git a/include/clang/AST/RecursiveASTVisitor.h b/include/clang/AST/RecursiveASTVisitor.h
index d593be8..e0a2a01 100644
--- a/include/clang/AST/RecursiveASTVisitor.h
+++ b/include/clang/AST/RecursiveASTVisitor.h
@@ -386,6 +386,12 @@
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(CXXRecordDecl, {
- // FIXME: don't traverse compiler-generated constructor,
- // destructor, and operator=, as they aren't written in the source
- // code.
TRY_TO(TraverseCXXRecordHelper(D));
})