Giter VIP home page Giter VIP logo

Comments (2)

jessevdk avatar jessevdk commented on July 23, 2024

To give some more detail, the responsible code is here: https://github.com/jessevdk/cldoc/blob/master/cldoc/tree.py#L305

Normally what happens is that functions returning a particular struct type are moved under that struct's page. This is loosely inspired by godoc, but is obviously wrong for C functions. There are actually two bugs in that code. The first assumes that every typedef is a struct-like thing. The second is to give priority to the return type over the first argument type. Maybe a better heuristic for the behavior is that only functions Type* type_new(...) are moved under Type.

Having said all that, I'm not sure about using any kind of non-trivial heuristic, since there will always be cases for which the heuristic doesn't work. Open to ideas.

from cldoc.

 avatar commented on July 23, 2024

Would it make sense to check for common alloc idioms (init, alloc, create, new) and give functions with those precedence for the return type, and associate other functions with the first parameter?

Type* type_new(Foo *param);

This would correctly associate the previous function with the right type, but prevent functions that return types but are part of another "type".

Of course this wouldn't hit everything, but might catch a good amount.

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.