[cfe-commits] r140587 - in /cfe/trunk: include/clang-c/Index.h tools/libclang/CXCursor.cpp tools/libclang/libclang.exports

Argyrios Kyrtzidis akyrtzi at gmail.com
Mon Sep 26 19:30:30 CDT 2011


Author: akirtzidis
Date: Mon Sep 26 19:30:30 2011
New Revision: 140587

URL: http://llvm.org/viewvc/llvm-project?rev=140587&view=rev
Log:
[libclang] Introduce clang_Cursor_isNull and clang_Cursor_getTranslationUnit functions.

Modified:
    cfe/trunk/include/clang-c/Index.h
    cfe/trunk/tools/libclang/CXCursor.cpp
    cfe/trunk/tools/libclang/libclang.exports

Modified: cfe/trunk/include/clang-c/Index.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=140587&r1=140586&r2=140587&view=diff
==============================================================================
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Mon Sep 26 19:30:30 2011
@@ -1555,6 +1555,13 @@
 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 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.

Modified: cfe/trunk/tools/libclang/CXCursor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXCursor.cpp?rev=140587&r1=140586&r2=140587&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CXCursor.cpp (original)
+++ cfe/trunk/tools/libclang/CXCursor.cpp Mon Sep 26 19:30:30 2011
@@ -519,6 +519,14 @@
 }
 
 //===----------------------------------------------------------------------===//
+// libclang CXCursor APIs
+//===----------------------------------------------------------------------===//
+
+CXTranslationUnit clang_Cursor_getTranslationUnit(CXCursor cursor) {
+  return getCursorTU(cursor);
+}
+
+//===----------------------------------------------------------------------===//
 // CXCursorSet.
 //===----------------------------------------------------------------------===//
 

Modified: cfe/trunk/tools/libclang/libclang.exports
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/libclang.exports?rev=140587&r1=140586&r2=140587&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/libclang.exports (original)
+++ cfe/trunk/tools/libclang/libclang.exports Mon Sep 26 19:30:30 2011
@@ -20,6 +20,7 @@
 clang_createIndex
 clang_createTranslationUnit
 clang_createTranslationUnitFromSourceFile
+clang_Cursor_getTranslationUnit
 clang_defaultCodeCompleteOptions
 clang_defaultDiagnosticDisplayOptions
 clang_defaultEditingTranslationUnitOptions




More information about the cfe-commits mailing list