In C++, an initializer on a variable doesn't necessarily mean it's the definition. With that in mind, rename getDefinition to getAnyInitializer (to distinguish it from getInit) and reimplement it in terms of isThisDeclarationADefinition. Update all code to use this new function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94999 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp
index 5e97494..0bb862e 100644
--- a/tools/CIndex/CIndex.cpp
+++ b/tools/CIndex/CIndex.cpp
@@ -1733,23 +1733,10 @@
   }
 
   case Decl::Var: {
-    VarDecl *Var = cast<VarDecl>(D);
-
-    // Variables with initializers have definitions.
-    const VarDecl *Def = 0;
-    if (Var->getDefinition(Def))
-      return MakeCXCursor(const_cast<VarDecl *>(Def), CXXUnit);
-
-    // extern and private_extern variables are not definitions.
-    if (Var->hasExternalStorage())
-      return clang_getNullCursor();
-
-    // In-line static data members do not have definitions.
-    if (Var->isStaticDataMember() && !Var->isOutOfLine())
-      return clang_getNullCursor();
-
-    // All other variables are themselves definitions.
-    return C;
+    // Ask the variable if it has a definition.
+    if (VarDecl *Def = cast<VarDecl>(D)->getDefinition())
+      return MakeCXCursor(Def, CXXUnit);
+    return clang_getNullCursor();
   }
    
   case Decl::FunctionTemplate: {