Giter VIP home page Giter VIP logo

Comments (9)

ymmt2005 avatar ymmt2005 commented on July 23, 2024

It seems that bundled clang/cindex.py is too old for clang 3.4.

from cldoc.

jessevdk avatar jessevdk commented on July 23, 2024

Yes, I've seen this problem coming. I'm not entirely sure what the best way to fix this is. Unfortunately, libclang isn't backwards compatible, or at least so it seems. I'll have a look if there is a robust way to distribute the python bindings for multiple versions of libclang and decide which to use at runtime.

from cldoc.

daringer avatar daringer commented on July 23, 2024

Hi hi,
yes I have the same problem, I would prefer to not downgrade clang ;)
Although, I tried to match the numbers (i.e. 114) from clang/cindex.py with some libclang-includes and could not guess where they exactly come from. Could you explain based on which files the cindex.py was generated(?)/hand-written?

To solve this issue generally there could be a cindex.py for specific clang versions and python could decide during cldoc execution dynamically which one to take - but just guessing, haven't really looked deeper into it ...

from cldoc.

jessevdk avatar jessevdk commented on July 23, 2024

The cindex.py is just taken from clang sources, but I had to apply some small patches. I know that's messy, but at the time I mostly wanted to get it working. So, I'd be very happy to have this issue resolved properly. The way forward for me would be:

  1. Decide to support a minimal version of clang (e.g. what major distros distribute these days)
  2. Check the cindex.py file distributed with that version and compare with the one currently checked into cldoc. See if locally applied patches still apply or not, etc.
  3. Check in pristine cindex.py for versions of clang from the minimal supported version up to the latest
  4. Do any required hot-fixes by re-applying previously made patches, if they still apply
  5. At runtime, decide which version of clang were talking to and load the right bindings. I'm not aware of a reliable way to get the clang version on the system though, so this requires some more thought.

Unfortunately, I don't really have time currently to work on this. If anyone wants to pick it up, all help is welcome

from cldoc.

daringer avatar daringer commented on July 23, 2024

Hehe, funny I haven't wasted one thought about cindex.py being a part of clang...
Well, as this is the case why not try to rely on the original clang python module and build a wrapper for it... I'm travelling the whole next week, thus there is also a no-time constraint for me, but after that I could look into this...

Could you maybe outline what kind of patches were applied to the clang module and why?
Are there real patches, which you could provide maybe? Or are we talking about hand-patches? ;)

from cldoc.

jessevdk avatar jessevdk commented on July 23, 2024

It's recorded in the history of that file. I think the only relevant patch was this one:
22c665e

Then there is one that is somewhat cosmetic, to make imports work since the files were moved in a subdir:
4bb8d72#diff-0a66b3f487eb9ac81a636fa6b862bb69

As far as I remember, the initial import of cindex.py was taken from clang. If someone looks at this at some point, it might be worth thinking also about py3 support. For now I have postponed it mostly because cindex.py is not py3 compatible. A wip can be found here: https://github.com/jessevdk/cldoc/commits/wip/py3

from cldoc.

svenstaro avatar svenstaro commented on July 23, 2024

So this tool is completely broken on clang 3.4? I haven't actually tried it yet but checked the bugs before I did to make sure I didn't run into any showstoppers. I'm glad I did. :)

clang 3.4 has been out since 3 months already, it's probably time to give it full support.

Also about Python 3, did you try https://github.com/kennytm/clang-cindex-python3 ? It's somewhat out of date but might be a good start.

from cldoc.

jessevdk avatar jessevdk commented on July 23, 2024

Luckily it's all out on github then. As it happens to be, I've been busy with other things (shockingly!) the last months. Wrt py3, I've used the one you refer to with additional patches (see https://git.gnome.org/browse/gnome-code-assistance/tree/backends/c/clang/cindex.py). Yes, it would be nice to fix all these issues. If someone is willing to work on it, I'd be very happy to accept patches

from cldoc.

jessevdk avatar jessevdk commented on July 23, 2024

I think this was fixed. Please feel free to reopen if the problem still persists

from cldoc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.