[cfe-dev] tests of bindings/python fail?
Douglas Gregor
dgregor at apple.com
Tue Jul 5 07:45:57 PDT 2011
On Jul 3, 2011, at 8:16 PM, Eli Bendersky wrote:
> | We'll happily commit patches to keep the Python bindings working.
>
> - Doug
>
> I'm attaching a patch (diffed against trunk) with some fixes to the Python bindings, making its tests pass again (on Linux and Windows).
>
> Some details of the patch:
>
> * Implemented a new function in libclang: clang_isAttr - it is similar to existing clang_Is* functions. Also exposed it to the Python bindings as the is_attr method of Cursor
> * Fixing TranslationUnit.get_includes to only go through the argument buffer when it contains something. This fixed a crash on Windows
> * clang_getFileName returns CXString, not char*. Made appropriate fixes in cindex.py - now the relevant tests pass and we can see the full locations correctly again (previously there was garbage in place of the file name)
> * Exposed clang_getCursorDisplayName to the python bindings
Very nice.
> P.S. the patch file was created with 'svn diff' in the root of clang, so it should be applied as 'patch -p0' there. I hope this is an accepted way to submit patches - if something different is required, I'll gladly fix.
Yes, this is the right way to submit patches, thanks for working on this!
A few minor comments:
Index: include/clang-c/Index.h
===================================================================
--- include/clang-c/Index.h (revision 134366)
+++ include/clang-c/Index.h (working copy)
@@ -1474,6 +1474,11 @@
CINDEX_LINKAGE unsigned clang_isStatement(enum CXCursorKind);
/**
+ * \brief Determine whether the given cursor kind represents an attribute.
+ */
+CINDEX_LINKAGE unsigned clang_isAttr(enum CXCursorKind);
+
+/**
Please name this "clang_isAttribute" to be more consistent with the naming of similar functions.
Index: tools/libclang/libclang.exports
===================================================================
--- tools/libclang/libclang.exports (revision 134366)
+++ tools/libclang/libclang.exports (working copy)
@@ -123,6 +123,7 @@
clang_isReference
clang_isRestrictQualifiedType
clang_isStatement
+clang_isAttr
clang_isTranslationUnit
clang_isUnexposed
clang_isVirtualBase
This list is meant to be sorted. Also, please update libclang.darwin.exports as well.
- Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110705/2a08b066/attachment.html>
More information about the cfe-dev
mailing list