Local variables have no linkage, make invalid Entities.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107630 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Index/Entity.cpp b/lib/Index/Entity.cpp
index 8178fbe..b6fb17f 100644
--- a/lib/Index/Entity.cpp
+++ b/lib/Index/Entity.cpp
@@ -111,6 +111,10 @@
 }
 
 Entity EntityGetter::VisitVarDecl(VarDecl *D) {
+  // Local variables have no linkage, make invalid Entities.
+  if (D->hasLocalStorage())
+    return Entity();
+
   // If it's static it cannot be referred to by another translation unit.
   if (D->getStorageClass() == VarDecl::Static)
     return Entity(D);