aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang-c/Index.h2
-rw-r--r--tools/libclang/CIndex.cpp9
2 files changed, 6 insertions, 5 deletions
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h
index d1840f5e6b..663737a0f3 100644
--- a/include/clang-c/Index.h
+++ b/include/clang-c/Index.h
@@ -648,7 +648,6 @@ CINDEX_LINKAGE void clang_disposeTranslationUnit(CXTranslationUnit);
*/
enum CXCursorKind {
/* Declarations */
- CXCursor_FirstDecl = 1,
/**
* \brief A declaration whose specific kind is not exposed via this
* interface.
@@ -707,6 +706,7 @@ enum CXCursorKind {
/** \brief A linkage specification, e.g. 'extern "C"'. */
CXCursor_LinkageSpec = 23,
+ CXCursor_FirstDecl = CXCursor_UnexposedDecl,
CXCursor_LastDecl = CXCursor_LinkageSpec,
/* References */
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 505633649a..945d05bf23 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -1585,10 +1585,11 @@ static CXString getDeclSpelling(Decl *D) {
// ObjCCategoryImplDecl returns the category name.
return createCXString(CIMP->getIdentifier()->getNameStart());
- if (ND->getIdentifier())
- return createCXString(ND->getIdentifier()->getNameStart());
-
- return createCXString("");
+ llvm::SmallString<1024> S;
+ llvm::raw_svector_ostream os(S);
+ ND->printName(os);
+
+ return createCXString(os.str());
}
CXString clang_getCursorSpelling(CXCursor C) {