diff options
Diffstat (limited to 'bindings/python/clang/cindex.py')
| -rw-r--r-- | bindings/python/clang/cindex.py | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/bindings/python/clang/cindex.py b/bindings/python/clang/cindex.py index b53661a4d0ae..56fcc78763e3 100644 --- a/bindings/python/clang/cindex.py +++ b/bindings/python/clang/cindex.py @@ -881,7 +881,7 @@ CursorKind.INVALID_CODE = CursorKind(73) CursorKind.UNEXPOSED_EXPR = CursorKind(100) # An expression that refers to some value declaration, such as a function, -# varible, or enumerator. +# variable, or enumerator. CursorKind.DECL_REF_EXPR = CursorKind(101) # An expression that refers to a member of a struct, union, class, Objective-C @@ -1501,7 +1501,7 @@ class Cursor(Structure): return conf.lib.clang_getCursorDefinition(self) def get_usr(self): - """Return the Unified Symbol Resultion (USR) for the entity referenced + """Return the Unified Symbol Resolution (USR) for the entity referenced by the given cursor (or None). A Unified Symbol Resolution (USR) is a string that identifies a @@ -1511,6 +1511,12 @@ class Cursor(Structure): another translation unit.""" return conf.lib.clang_getCursorUSR(self) + def get_included_file(self): + """Returns the File that is included by the current inclusion cursor.""" + assert self.kind == CursorKind.INCLUSION_DIRECTIVE + + return conf.lib.clang_getIncludedFile(self) + @property def kind(self): """Return the kind of this cursor.""" @@ -1644,7 +1650,7 @@ class Cursor(Structure): def result_type(self): """Retrieve the Type of the result for this Cursor.""" if not hasattr(self, '_result_type'): - self._result_type = conf.lib.clang_getResultType(self.type) + self._result_type = conf.lib.clang_getCursorResultType(self) return self._result_type @@ -3085,8 +3091,9 @@ class File(ClangObject): return "<File: %s>" % (self.name) @staticmethod - def from_cursor_result(res, fn, args): - assert isinstance(res, File) + def from_result(res, fn, args): + assert isinstance(res, c_object_p) + res = File(res) # Copy a reference to the TranslationUnit to prevent premature GC. res._tu = args[0]._tu @@ -3568,6 +3575,11 @@ functionList = [ [Cursor, c_uint, c_uint], SourceRange), + ("clang_getCursorResultType", + [Cursor], + Type, + Type.from_result), + ("clang_getCursorSemanticParent", [Cursor], Cursor, @@ -3696,8 +3708,8 @@ functionList = [ ("clang_getIncludedFile", [Cursor], - File, - File.from_cursor_result), + c_object_p, + File.from_result), ("clang_getInclusions", [TranslationUnit, callbacks['translation_unit_includes'], py_object]), |
