Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] ASTRewrite: Comment handling


I filed a bug at

On 29.01.2014 14:38, Corbat Thomas wrote:
Hi Simon

At a glance, that indeed looks like a bug. It probably doesn't make sense to have a comment assigned to an (AST) node after the node enclosing the comment. Could you please file a bug, then we (Lukas Felber and I) will have a look at it.

Thanks a lot

-----Original Message-----
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Simon Taddiken
Sent: Mittwoch, 29. Januar 2014 14:21
To: cdt-dev@xxxxxxxxxxx
Subject: [cdt-dev] ASTRewrite: Comment handling


I'm currently working with the ASTRewrite for moving methods around and stumbled upon the following which I consider to be a bug. Given the following code snippet:

#ifndef A_H_
#define A_H_

class Base {
class Derived : Base {
      void myMethod(int a) {
          // comment in body
#endif /* A_H_ */

In this sample, the body comment of the method is considered to be a leading comment to the #endif node by the ASTRewrite for that TranslationUnit. This kind of makes sense because its the next node after the comment, but I feel the comment should rather be associated with the method it stands in. For now it takes some crazy extra effort to move all the comments of one method definition to a copy, because in the sample above, the comment is not associated with any node which belongs to the definition.
cdt-dev mailing list
cdt-dev mailing list

Back to the top