Bug 537066 - Trailing comment at if condition is assigned as leading comment of then clause
Summary: Trailing comment at if condition is assigned as leading comment of then clause
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-parser (show other bugs)
Version: 9.5.0   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-16 06:54 EDT by alex Loskutov CLA
Modified: 2020-09-04 15:27 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description alex Loskutov CLA 2018-07-16 06:54:33 EDT
example code:

int main(void) {
	if(true && true) //_comment_
	{

	}
}

I do not know if this is intended but I would expect that _comment_ is assigned as the trailing comment of the if condition node but it is assigned as the leading comment of the then clause node.
Comment 1 Nathan Ridge CLA 2018-07-16 10:24:41 EDT
What do you mean by "assigned"? What API reflects this assignment? Is there a user operation for which it matters?
Comment 2 alex Loskutov CLA 2018-07-16 10:52:01 EDT
No public API bt I am working with org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap and its respective methods e.g. #getTrailingCommentsForNode(IASTNode)