Bug 173874

Summary: CPPClassType returns duplicate nested classes
Product: [Tools] CDT Reporter: Bryan Wilkinson <bryan2233>
Component: cdt-coreAssignee: Doug Schaefer <cdtdoug>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 Keywords: contributed
Version: 4.0   
Target Milestone: 4.0 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
proposed patch bjorn.freeman-benson: iplog+

Description Bryan Wilkinson CLA 2007-02-12 10:22:06 EST
CPPClassType.getNestedClasses() often returns the same nested class multiple times.

Example:

class aClass {
  class bClass;
  int x;
};

In this case, getNestedClasses() would return a list containing two identical bindings for bClass.
Comment 1 Bryan Wilkinson CLA 2007-02-12 10:35:02 EST
Created attachment 58775 [details]
proposed patch

Fixes CPPClassType.getNestedClasses()

A variable was not being set back to null after each iteration of a loop going through each of the declarations within the class.
Comment 2 Doug Schaefer CLA 2007-02-14 11:17:05 EST
It is wild how many day one bugs you're finding. Thanks!
Comment 3 Doug Schaefer CLA 2007-02-14 11:19:39 EST
Patch applied. Feel free to contribute JUnit tests as well ;). I have written one for this bug in CompleteParser2Tests.