From d08900848307fdaea19d52249bdced94eefdb9bb Mon Sep 17 00:00:00 2001
From: Argyrios Kyrtzidis <akyrtzi@gmail.com>
Date: Tue, 7 Feb 2012 22:46:16 +0000
Subject: [PATCH] [libclang] Do not index implicit C++ member functions.
 rdar://10769813

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150007 91177308-0d34-0410-b5e6-96231b3b80d8
---
 tools/libclang/IndexDecl.cpp       | 3 +++
 tools/libclang/IndexingContext.cpp | 2 +-
 tools/libclang/IndexingContext.h   | 2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/libclang/IndexDecl.cpp b/tools/libclang/IndexDecl.cpp
index c6080df5928..d2eb402ba28 100644
--- a/tools/libclang/IndexDecl.cpp
+++ b/tools/libclang/IndexDecl.cpp
@@ -243,6 +243,9 @@ public:
 } // anonymous namespace
 
 void IndexingContext::indexDecl(const Decl *D) {
+  if (D->isImplicit() && shouldIgnoreIfImplicit(D))
+    return;
+
   bool Handled = IndexingDeclVisitor(*this).Visit(const_cast<Decl*>(D));
   if (!Handled && isa<DeclContext>(D))
     indexDeclContext(cast<DeclContext>(D));
diff --git a/tools/libclang/IndexingContext.cpp b/tools/libclang/IndexingContext.cpp
index 32eb326abbb..2e69c468494 100644
--- a/tools/libclang/IndexingContext.cpp
+++ b/tools/libclang/IndexingContext.cpp
@@ -1012,7 +1012,7 @@ CXCursor IndexingContext::getRefCursor(const NamedDecl *D, SourceLocation Loc) {
   return clang_getNullCursor();
 }
 
-bool IndexingContext::shouldIgnoreIfImplicit(const NamedDecl *D) {
+bool IndexingContext::shouldIgnoreIfImplicit(const Decl *D) {
   if (isa<ObjCInterfaceDecl>(D))
     return false;
   if (isa<ObjCCategoryDecl>(D))
diff --git a/tools/libclang/IndexingContext.h b/tools/libclang/IndexingContext.h
index bc33005e89d..ef8e24e7c34 100644
--- a/tools/libclang/IndexingContext.h
+++ b/tools/libclang/IndexingContext.h
@@ -459,7 +459,7 @@ private:
 
   CXCursor getRefCursor(const NamedDecl *D, SourceLocation Loc);
 
-  static bool shouldIgnoreIfImplicit(const NamedDecl *D);
+  static bool shouldIgnoreIfImplicit(const Decl *D);
 };
 
 class ScratchAlloc {
-- 
GitLab