[llvm-bugs] [Bug 24471] libclang python bindings do not reparse file

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Aug 17 01:53:50 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24471

Jean-Marc Le Roux <jeanmarc.leroux at aerys.in> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Jean-Marc Le Roux <jeanmarc.leroux at aerys.in> ---
Not a clang bug. It's a python mistake (cf
http://stackoverflow.com/questions/1132941/least-astonishment-in-python-the-mutable-default-argument).
Correct code:

    def _get_minko_script_classes(self, root):
        return self._get_minko_script_classes_rec(root, [])

    def _get_minko_script_classes_rec(self, root, cursors):
        for cursor in root.get_children():
            if cursor.kind == clang.cindex.CursorKind.CLASS_DECL:
                for c in cursor.get_children():
                    if c.kind == clang.cindex.CursorKind.CXX_BASE_SPECIFIER:
                        if c.displayname == "minko::component::AbstractScript":
                            cursors.append(cursor)
            else:
                self._get_minko_script_classes_rec(cursor, cursors)

        return cursors

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150817/2299d342/attachment.html>


More information about the llvm-bugs mailing list