Implement clang_getCanonicalCursor() in libclang, which does the obvious thing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119874 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 9137172..9116667 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -3717,6 +3717,16 @@
return clang_getCursorDefinition(C) == C;
}
+CXCursor clang_getCanonicalCursor(CXCursor C) {
+ if (!clang_isDeclaration(C.kind))
+ return C;
+
+ if (Decl *D = getCursorDecl(C))
+ return MakeCXCursor(D->getCanonicalDecl(), getCursorTU(C));
+
+ return C;
+}
+
unsigned clang_getNumOverloadedDecls(CXCursor C) {
if (C.kind != CXCursor_OverloadedDeclRef)
return 0;