Bug 66108 - [Class Browser] C++ browser cannot show members of class
Summary: [Class Browser] C++ browser cannot show members of class
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1   Edit
Assignee: John Camelon CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 59493
Blocks:
  Show dependency tree
 
Reported: 2004-06-08 08:51 EDT by Joost Kraaijeveld CLA
Modified: 2004-08-12 08:34 EDT (History)
5 users (show)

See Also:


Attachments
source file in question (9.66 KB, text/plain)
2004-06-08 10:42 EDT, John Camelon CLA
no flags Details
test project (38.55 KB, application/zip)
2004-07-02 15:17 EDT, Chris Wiebe CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joost Kraaijeveld CLA 2004-06-08 08:51:43 EDT
If the definition and/or implementation of a class is done completely with a
macro, the C++ browser cannot show the members of that class.
Comment 1 John Camelon CLA 2004-06-08 09:38:51 EDT
Please provide an example to demonstrate the behaviour.
Does this problem exist in the Outline as well?
Comment 2 John Camelon CLA 2004-06-08 10:42:50 EDT
Created attachment 11731 [details]
source file in question

Here is the source file that is offending, Chris.  
The outline handles it properly, but when you try to browse in the class
browser to the class InvalidParameter, it craps out.
Comment 3 Alain Magloire CLA 2004-06-08 12:17:12 EDT
It looks like the indexer does not report anything.

You will have also nothing if you start the Indexer.

The class browsing and the Open Type now rely completely
on the indexer to provide the information.
Comment 4 Chris Wiebe CLA 2004-06-18 15:02:17 EDT
What I am seeing: the class InvalidParameter shows up in the TypesView but the
MembersView is empty.  Is this what you mean by "craps out"?

There appears to be a problem with the parser reporting incorrect offsets when
expanding the macros.  The browser attempts to locate the ICElement for the
class InvalidParameter by calling TranslationUnit.getElementAtOffset().  What
happens here is the offset of the class and all of its children are the same so
the wrong element is found.

Can you take a look at this, John?
Comment 5 John Camelon CLA 2004-06-18 15:37:20 EDT
Those offsets are correct, they are what is necessary for the outline view. 
TranslationUnit.getElementAtOffset() should really be 
TranslationUnit.getElementsAtOffset() (an array) due to macro expansions.  
CC-ing Alain for his opinion and assigning to the inbox.  
Comment 6 Chris Wiebe CLA 2004-06-18 16:58:55 EDT
Alain would love to do this. :)
Comment 7 Alain Magloire CLA 2004-06-18 23:19:04 EDT
> Alain would love to do this. :)

Done, let me know if it works for you.
Comment 8 Chris Wiebe CLA 2004-06-21 15:51:00 EDT
Fixed.
Comment 9 Chris Wiebe CLA 2004-07-02 15:17:39 EDT
Created attachment 12946 [details]
test project

Zip file contains project with reproduceable case.
Comment 10 Chris Wiebe CLA 2004-07-02 15:20:56 EDT
Reopening to track problems showing up in Joost's test project.

The file Exception.cpp does not display properly in the outline view.  Looks
like it's not getting parsed correctly.
Comment 11 Chris Wiebe CLA 2004-07-02 15:35:51 EDT
If I comment out the "#include <windows.h>" in Exception.cpp the class
declaration shows up correctly in the outline view.  It appears to just fail
silently - there's nothing being written to the error log.

John, can you take at look at this?
Comment 12 Chris Wiebe CLA 2004-07-02 15:37:29 EDT
I'm also seeing a lot of flickering in the outline view when I make a change. 
Looks like it's redrawing 4 or 5 times.  (This is on Win2K).
Comment 13 Chris Wiebe CLA 2004-07-02 16:19:49 EDT
The class forward declaration for ExceptionText in Exception.hpp also causing a
problem.  The type cache is relying on this symbol from the indexer instead of
the actual declaration (and hence the correct location).  See bug# 59493.
Comment 14 John Camelon CLA 2004-07-05 07:51:48 EDT
I've seen the flickering too ... some one on the newsgroup also commented upon 
it.  Perhaps Hoda can take a look @ it this week ... 
Comment 15 John Camelon CLA 2004-07-05 08:10:54 EDT
Chris, 

Are you recommending to people to use the "follow #include's" mode on the 
Outliner in order to get the browsing view working properly?  I don't think 
that's a good idea.  
Comment 16 Chris Wiebe CLA 2004-07-05 11:44:38 EDT
The "follow #includes" thing is just a workaround for the time being.  I'm
hoping that with your new and improved parser, we can do a full parse every time
so this won't be an issue - is that a reasonable assumption?
Comment 17 John Camelon CLA 2004-07-05 13:13:49 EDT
Definitely not for 2.0.1.  
Most likely not for 2.1 unless we can figure out some sort of caching 
strategy.  It is not a workable solution to parse #include files on 
reconcile.  
Comment 18 Hoda Amer CLA 2004-07-06 10:26:04 EDT
The flickering bug has been fixed in Head and branch.
Comment 19 John Camelon CLA 2004-08-10 09:53:27 EDT
Even if we get parse times down to a second on a seriously complex file, I 
don't think we can use STRUCTURAL_PARSE on reconcile.  
Comment 20 Chris Wiebe CLA 2004-08-11 17:20:57 EDT
Original bug has been verified fixed (getElementsAtOffset() and indexer class
forward bug# 59493). The only outstanding issue is bug# 71736 (ie follow
#includes must be turned on or the C++ class with macros may not display
correctly) but this affects the whole CModel so I think we can deal with this
elsewhere (or create a separate PR).

Should already be fixed in head and 2.0.1. Can someone please mark this one
fixed - I guess my new committer powers don't extend to bugzilla...
Comment 21 John Camelon CLA 2004-08-12 08:34:58 EDT
Your committer powers should extend to bugzilla!
Perhaps Doug or Kleo can send an email on your behalf to the powers that be.