Bug 102182 - F3] Open Declaration on macro not working in particular project
Summary: F3] Open Declaration on macro not working in particular project
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-parser (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 RC2   Edit
Assignee: Bogdan Gheorghe CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2005-06-29 14:01 EDT by John Camelon CLA
Modified: 2008-06-19 13:05 EDT (History)
1 user (show)

See Also:


Attachments
project in question (5.50 KB, application/zip)
2005-06-29 14:05 EDT, John Camelon CLA
no flags Details
fix for this PR on the search side of things (4.20 KB, application/x-zip-compressed)
2005-06-29 15:31 EDT, Devin Steffler CLA
no flags Details
updated fix for this PR (36.65 KB, patch)
2005-07-07 14:07 EDT, Devin Steffler 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 John Camelon CLA 2005-06-29 14:01:07 EDT
I will attach a project that will demonstrate the problem.
Comment 1 John Camelon CLA 2005-06-29 14:05:00 EDT
Created attachment 24142 [details]
project in question

1.  Open the project, build it make sure that the scanner info looks OK.  
2.  Open the DOM Viewer on the parse tree for main.c and inspect it.  
3.  Select JEDEN in main.c and try F3 on it.  It should go to the definition in
macro.h but instead nothing happens.  (No error, no navigation).
Comment 2 John Camelon CLA 2005-06-29 14:06:10 EDT
Devin, pls investigate and let me know if this is something that can be fixed
for RC2.
Comment 3 John Camelon CLA 2005-06-29 14:48:20 EDT
Is it purely dependent upon 102066?
Does the Location Map return the macro expansion properly?  If so, why does it
need the index to Open Declaration on it, since the macro is available through
the parse?
Comment 4 Devin Steffler CLA 2005-06-29 14:52:08 EDT
It is dependent on 102066 and a patch that I have.

The macro is not available through the parse, if you look at the JEDEN IASTName 
properties in the DOM AST Viewer then you will see it has a ProblemBinding.

This search functionality requires the index.
Comment 5 John Camelon CLA 2005-06-29 15:08:07 EDT
-imacros yield offsets of -1 for some reason. 
Comment 6 Devin Steffler CLA 2005-06-29 15:31:43 EDT
Created attachment 24150 [details]
fix for this PR on the search side of things

Improved Open Declarations/Definitions/All Declarations so that the index used
even if an exception occurs elsewhere.
Added MACRO when building the SearchFor for UNKNOWN_SEARCH_FOR and added
DECLARATIONS_DEFINITIONS to CSearchPattern#createMacroPattern().
Removed the error message "CSearchOperation.tooManyNames.message= The operation
is unavailable on the current selection (too many different names selected)."
as now if many names are selected only the first name selected is used in the
search.
Comment 7 John Camelon CLA 2005-07-04 16:50:02 EDT
Bogdan, what do you think of Devin's patch?
Comment 8 John Camelon CLA 2005-07-04 17:52:03 EDT
I've fixed the original NPE in CVS HEAD.   
Assign to Bogdan for him to look over Devin's patch.  
Comment 9 Devin Steffler CLA 2005-07-05 13:14:41 EDT
Please take a look at the attached patch and apply/reject it.
Comment 10 Devin Steffler CLA 2005-07-07 14:07:23 EDT
Created attachment 24434 [details]
updated fix for this PR

main changes:
- added try/catch to OpenDeclarationsAction/OpenDefinitionAction surrounding
steps 2/3 (if find against DOM/Index throw an exception then try simple index
search)
- fixed the if/else structure so that a simple search against the index is
attempted if both DOM/Index searches fail (used to be only if the DOM search
failed)
- removed the error "too many names selected" since the first selected name is
searched if several names are selected
Comment 11 Bogdan Gheorghe CLA 2005-07-07 14:40:38 EDT
Patch committed. Thanks Devin!

- BG