Community
Participate
Working Groups
This is a wierd one. If I define something in an exteranl file, F3 (Open Declaration) gives the proper result, but searching All Declarations > Workspace gives a bad result. Testing environment: M200408111300 I200408120400 J9 JRE 1. Create mgd C++ project (problem in properly configure std project too but this is faster) 2. Add the following to a main.cpp file #include <iostream> #include "findme.h" using namespace std; int main(int argc, char **argv) { cout << "Find code is: " << FOUND_ME << endl; return (0); } 3. Create an external file, findme.h, somewhere on your machine (not in the workspace) with contents: const int FOUND_ME =1; 4. Add the path to the file to the project's build properties do something to trigger an index 5. Do an F3 on FOUND_ME and the header file will be opened in an editor. Cool. 6. Now try All Declarations > Workspace. You will see that the result will be the main file at offset 11. This is the offset of the symbol in the header file. It's almost as though the search has the offset right, but the file wrong. Anyway, this seems like a bug.
Because the scanner is 1 token ahead of the parser, when we get the semi colon to complete the FOUND_ME declaration, the scanner immediately gets the next token and encounters the end of the include file and does the callback exitInclusion before the parser processed the semi-colon and does the callback for the variable declaration. The result is that clients think that this variable declaration is happening outside the inclusion instead of being the last thing in the inclusion.
What is your proposed solution, oh stealer of defects?
This should be fixed for 2.0.1, it will affect more than just Search/Index.
fixed in head and 2.0.1 Fix postpones the reporting of callback if we were getting the token one ahead.
Verified fixed in cdt 2.0.1 build 20040826
Marking verified for Tanya.