summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-09-27 00:30:30 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-09-27 00:30:30 +0000
commitd6e9fa55eba409648503e87f20cde0b3e11c9d71 (patch)
tree8429cf30b005febd28b589cb9b161dc4f83f41da /clang
parent698bd3113e079624143bd3841c76e5567bf1d7b7 (diff)
downloadbcm5719-llvm-d6e9fa55eba409648503e87f20cde0b3e11c9d71.tar.gz
bcm5719-llvm-d6e9fa55eba409648503e87f20cde0b3e11c9d71.zip
[libclang] Introduce clang_Cursor_isNull and clang_Cursor_getTranslationUnit functions.
llvm-svn: 140587
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang-c/Index.h12
-rw-r--r--clang/tools/libclang/CXCursor.cpp8
-rw-r--r--clang/tools/libclang/libclang.exports1
3 files changed, 21 insertions, 0 deletions
diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h
index 07bcf9eec6e..6bd0286d6ec 100644
--- a/clang/include/clang-c/Index.h
+++ b/clang/include/clang-c/Index.h
@@ -1555,6 +1555,13 @@ CINDEX_LINKAGE CXCursor clang_getTranslationUnitCursor(CXTranslationUnit);
CINDEX_LINKAGE unsigned clang_equalCursors(CXCursor, CXCursor);
/**
+ * \brief Returns non-zero if \arg cursor is null.
+ */
+static inline int clang_Cursor_isNull(CXCursor cursor) {
+ return clang_equalCursors(cursor, clang_getNullCursor());
+}
+
+/**
* \brief Compute a hash value for the given cursor.
*/
CINDEX_LINKAGE unsigned clang_hashCursor(CXCursor);
@@ -1669,6 +1676,11 @@ CINDEX_LINKAGE enum CXLanguageKind {
*/
CINDEX_LINKAGE enum CXLanguageKind clang_getCursorLanguage(CXCursor cursor);
+/**
+ * \brief Returns the translation unit that a cursor originated from.
+ */
+CINDEX_LINKAGE CXTranslationUnit clang_Cursor_getTranslationUnit(CXCursor);
+
/**
* \brief A fast container representing a set of CXCursors.
diff --git a/clang/tools/libclang/CXCursor.cpp b/clang/tools/libclang/CXCursor.cpp
index eb54ed2b688..c0e038467fb 100644
--- a/clang/tools/libclang/CXCursor.cpp
+++ b/clang/tools/libclang/CXCursor.cpp
@@ -519,6 +519,14 @@ bool cxcursor::isFirstInDeclGroup(CXCursor C) {
}
//===----------------------------------------------------------------------===//
+// libclang CXCursor APIs
+//===----------------------------------------------------------------------===//
+
+CXTranslationUnit clang_Cursor_getTranslationUnit(CXCursor cursor) {
+ return getCursorTU(cursor);
+}
+
+//===----------------------------------------------------------------------===//
// CXCursorSet.
//===----------------------------------------------------------------------===//
diff --git a/clang/tools/libclang/libclang.exports b/clang/tools/libclang/libclang.exports
index d01bb07f0c8..71cd2614385 100644
--- a/clang/tools/libclang/libclang.exports
+++ b/clang/tools/libclang/libclang.exports
@@ -20,6 +20,7 @@ clang_createCXCursorSet
clang_createIndex
clang_createTranslationUnit
clang_createTranslationUnitFromSourceFile
+clang_Cursor_getTranslationUnit
clang_defaultCodeCompleteOptions
clang_defaultDiagnosticDisplayOptions
clang_defaultEditingTranslationUnitOptions
OpenPOWER on IntegriCloud