Bug 326998 - C/C++ Search alters search string when taking over a selection
Summary: C/C++ Search alters search string when taking over a selection
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 7.0   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-05 07:59 EDT by Jan Poganski CLA
Modified: 2020-09-04 15:22 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Poganski CLA 2010-10-05 07:59:26 EDT
Build Identifier: 7.0.0.201006141710

Searching for a particular struct variable with the C/C++ Search is not possible.

Reproducible: Always

Steps to Reproduce:
1. Select a piece of code similar to "myStruct.myVariable".
2. Click Search > C/C++

Result:
The search string taken over from the selection does not contain the dot anymore (in this example: "myStructmyVariable").
Comment 1 Markus Schorn CLA 2010-10-07 04:07:34 EDT
Let's consider the following example:
  struct S {
    int a;
  };
  void test() {
    S s;
    s.a= 1;
  }

When trying to search for 's.a' the dot is removed, because you can only search for (possibly qualified) names, but not for expressions. What you really want to search for is 'S::a', or simply 'a'.
As an alternative you can select 'a' and then use the context menu 'References - Workspace'.

To improve the experience with the C/C++ search in such a situation we 
could either:
  * drop the text before the '.', i.e convert 's.a' into 'a', or
  * use the parser to convert the field-access expressions into the member
    it refers to (s.a -> S::a). This would raise the question whether the
    same should be done for names (a -> S::a).