Skip to main content

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

Hi Thomas, Lukas

Is the comment parsing/handling still actively maintained? I saw the paper [1] assumed that the work is no longer maintained. When trying to use the implementation, I ran into many cases where comments are lost or assigned wrong. So I ended up implementing my own comment handler. But if it's still maintained I could make bug reports. I have dozens of test cases for my own implementation. In the beginning I ran them through your implementation too but none were handled correctly. Another big problem I have I reported in this bug:


[1] Peter Sommerlad, Guido Zgraggen, Thomas Corbat, Lukas Felber: Retaining comments when refactoring code. OOPSLA Companion 2008: 653-662

On 01/29/2014 02:38 PM, 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