]> granicus.if.org Git - clang/commitdiff
Don't visit implicitly defined functions (default constructors and the
authorCraig Silverstein <csilvers2000@yahoo.com>
Fri, 2 Jul 2010 19:07:50 +0000 (19:07 +0000)
committerCraig Silverstein <csilvers2000@yahoo.com>
Fri, 2 Jul 2010 19:07:50 +0000 (19:07 +0000)
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

index d593be81f9f6079613d91cd0abc785dbd1d08afd..e0a2a015d4f4d492d44d39ab99d39428d278321f 100644 (file)
@@ -386,6 +386,12 @@ bool RecursiveASTVisitor<Derived>::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));
   })