Bug 183930 - [Scanner] AST does not contain comments from inactive code
Summary: [Scanner] AST does not contain comments from inactive code
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-parser (show other bugs)
Version: 4.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 4.0 M7   Edit
Assignee: Emanuel Graf CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks: 79459
  Show dependency tree
 
Reported: 2007-04-25 03:11 EDT by Markus Schorn CLA
Modified: 2008-06-20 11:26 EDT (History)
1 user (show)

See Also:


Attachments
patch (4.53 KB, patch)
2007-04-27 08:39 EDT, Emanuel Graf CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Schorn CLA 2007-04-25 03:11:07 EDT
Similar as we provide include-directives for inactive code, we should also provide the comments for inactive code. If we don't do that the comments from the AST cannot be used for generating task tags.

Example:
#ifdef XXX
// todo implementation for XXX
#endif
Comment 1 Emanuel Graf CLA 2007-04-26 02:29:28 EDT
Is someone working on this? Otherwise I could take a look.
Comment 2 Markus Schorn CLA 2007-04-26 04:13:36 EDT
(In reply to comment #1)
> Is someone working on this? Otherwise I could take a look.

Great, it's yours.
Comment 3 Emanuel Graf CLA 2007-04-26 06:28:09 EDT
Thanks :)
Comment 4 Mike Kucera CLA 2007-04-26 10:09:36 EDT
BTW, I already have this working for the C99 parser. It was fairly easy to do since the lexer and preprocessor are separated. The lexer generates comment tokens, then the preprocessor filters and collects them. The tokens are later converted into comment nodes. There are two options; generate comment nodes for all comments, and generate comment nodes only for active code.
Comment 5 Emanuel Graf CLA 2007-04-27 04:47:55 EDT
I'll add this two option to my code. I think it would be best to define these options for all languages for example in AbstractLanguage? 
Comment 6 Emanuel Graf CLA 2007-04-27 08:39:33 EDT
Created attachment 65198 [details]
patch

Okay, changing the API is maybe not the best idea at this point in time. So I decided just to add the comments from inactive code.
Comment 7 Markus Schorn CLA 2007-05-02 08:36:27 EDT
Thanks Emanuel, I have applied the patch and enabled the testcase for the bug.