[libclang] Indexing API: make sure we do not try to index local declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144764 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/libclang/IndexBody.cpp b/tools/libclang/IndexBody.cpp
index 769a1c7..ece1ed4 100644
--- a/tools/libclang/IndexBody.cpp
+++ b/tools/libclang/IndexBody.cpp
@@ -32,35 +32,18 @@
   }
 
   bool VisitDeclRefExpr(DeclRefExpr *E) {
-    const NamedDecl *D = E->getDecl();
-    if (!D)
-      return true;
-    if (D->getParentFunctionOrMethod())
-      return true;
-    
-    IndexCtx.handleReference(D, E->getLocation(), 0, ParentDC, E);
+    IndexCtx.handleReference(E->getDecl(), E->getLocation(), 0, ParentDC, E);
     return true;
   }
 
   bool VisitMemberExpr(MemberExpr *E) {
-    const NamedDecl *D = E->getMemberDecl();
-    if (!D)
-      return true;
-    if (D->getParentFunctionOrMethod())
-      return true;
-    
-    IndexCtx.handleReference(D, E->getMemberLoc(), 0, ParentDC, E);
+    IndexCtx.handleReference(E->getMemberDecl(), E->getMemberLoc(), 0, ParentDC,
+                             E);
     return true;
   }
 
   bool VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
-    const NamedDecl *D = E->getDecl();
-    if (!D)
-      return true;
-    if (D->getParentFunctionOrMethod())
-      return true;
-    
-    IndexCtx.handleReference(D, E->getLocation(), 0, ParentDC, E);
+    IndexCtx.handleReference(E->getDecl(), E->getLocation(), 0, ParentDC, E);
     return true;
   }