aboutsummaryrefslogtreecommitdiff
path: root/include/clang-c
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-11-19 23:44:15 +0000
committerDouglas Gregor <dgregor@apple.com>2010-11-19 23:44:15 +0000
commit1a9d0503b67a499797141af0fd6d315d5045f0ea (patch)
treec14ff2a9bbf26b433754f17f0400fb2cf4f9b37c /include/clang-c
parent2aa9267cf193e5eceb9fd24a51b51c031b606fe9 (diff)
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
Diffstat (limited to 'include/clang-c')
-rw-r--r--include/clang-c/Index.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h
index 2fc4089735..ebe74e2d2f 100644
--- a/include/clang-c/Index.h
+++ b/include/clang-c/Index.h
@@ -2075,6 +2075,32 @@ CINDEX_LINKAGE CXCursor clang_getCursorDefinition(CXCursor);
CINDEX_LINKAGE unsigned clang_isCursorDefinition(CXCursor);
/**
+ * \brief Retrieve the canonical cursor corresponding to the given cursor.
+ *
+ * In the C family of languages, many kinds of entities can be declared several
+ * times within a single translation unit. For example, a structure type can
+ * be forward-declared (possibly multiple times) and later defined:
+ *
+ * \code
+ * struct X;
+ * struct X;
+ * struct X {
+ * int member;
+ * };
+ * \endcode
+ *
+ * The declarations and the definition of \c X are represented by three
+ * different cursors, all of which are declarations of the same underlying
+ * entity. One of these cursor is considered the "canonical" cursor, which
+ * is effectively the representative for the underlying entity. One can
+ * determine if two cursors are declarations of the same underlying entity by
+ * comparing their canonical cursors.
+ *
+ * \returns The canonical cursor for the entity referred to by the given cursor.
+ */
+CINDEX_LINKAGE CXCursor clang_getCanonicalCursor(CXCursor);
+
+/**
* @}
*/