Loosen preconditions for clang_getCursorSpelling(), returning an empty
string when given a cursor that does not have a name. Also, don't give
silly names for statements and non-reference expressions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94426 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp
index eb40b7f..26c9273 100644
--- a/tools/CIndex/CIndex.cpp
+++ b/tools/CIndex/CIndex.cpp
@@ -1349,7 +1349,10 @@
     return CIndexer::createCXString("");
   }
 
-  return getDeclSpelling(getCursorDecl(C));
+  if (clang_isDeclaration(C.kind))
+    return getDeclSpelling(getCursorDecl(C));
+  
+  return CIndexer::createCXString("");
 }
 
 const char *clang_getCursorKindSpelling(enum CXCursorKind Kind) {