Giter Site home page Giter Site logo

Bug in C++ template parsing about neogen HOT 7 CLOSED

flanggut avatar flanggut commented on August 17, 2024
Bug in C++ template parsing

from neogen.

Comments (7)

flanggut avatar flanggut commented on August 17, 2024 1

Looks great! Thanks 👍

from neogen.

flanggut avatar flanggut commented on August 17, 2024

As an example for this header file:

#pragma once

template <typename D> class Foo {
public:
  float bar(float a) { return a; }
};

And with the cursor on bar, I am getting documentation like this when I call generate:

#pragma once

/**
 * @brief 
 *
 * @tparam D 
 * @param a 
 */
template <typename D> class Foo {
public:
  /**
   * @brief 
   *
   * @param a 
   * @return 
   */
  float bar(float a) { return a; }
};

As a side note: I think the root node might not be considered at all, so I had to create a different root with #pragma once.

from neogen.

danymat avatar danymat commented on August 17, 2024

I don't think I understand correctly... In order for me to understand, can you do a snippet of what the current generation is doing, and what the annotation should look like ?

from neogen.

flanggut avatar flanggut commented on August 17, 2024

I already did. If you take the snippet from my previous comment

#pragma once

template <typename D> class Foo {
public:
  float bar(float a) { return a; }
};

and you generate annotations for the function bar you get two annotations, one for the function and a wrong one for the class Foo.

from neogen.

flanggut avatar flanggut commented on August 17, 2024

Specifically this is what I get


#pragma once

/**
 * @brief 
 *
 * @tparam D 
 * @param a 
 */
template <typename D> class Foo {
public:
  /**
   * @brief 
   *
   * @param a 
   * @return 
   */
  float bar(float a) { return a; }
};

And this is what I would expect


#pragma once

template <typename D> class Foo {
public:
  /**
   * @brief 
   *
   * @param a 
   * @return 
   */
  float bar(float a) { return a; }
};

from neogen.

danymat avatar danymat commented on August 17, 2024

Oh yeah right, it's a bug indeed

from neogen.

danymat avatar danymat commented on August 17, 2024

Hello once again, this should fix the bug that caused those multiple annotations. Can you check again ?

PS: this fix will make Neogen potentially faster than previous versions, because it only parses one tree and execute generation only on this... 🥂

from neogen.

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.