I have found that the mechanism of remove files in the Tokenstree has a big problem. I guess this problem exist for a long time, both in trunk and cc_branch. I have recently confined it in ccbranch.
For example, I have a simple project contains only one cpp and h file.
h file
class TestStruct
{
int aaaaa;
int Test();
};
cpp file:
#include "main.h"
int TestStruct::Test(){
}
Now, if we are editing the "header file", then this file will be "reparsed" in real-time mode.
When one file is reparsed, the tokenstree firstly remove the header file( all the tokens belong to that file will be removed), then the header file get reparsed.
The problem is: when header file was removed from Tokenstree, all the function implementation information will be removed too, thus, the some token information in cpp file are lost.
I debug the CC, and found the reason:
1, when delete a token, tokenstree check if the token is belong to some file else, if yes, the token will not be deleted.
2, when a token is deleted, all its child token will be deleted.
Now, see the Token "class TestStruct", it is purely belong to the header file, so, this Token and its children are deleted. As a result, we lost the token "function int TestStruct::Test()".
That's why sometimes, we edit the header file, and "goto implementation of some function" failed.
Currently, we don't have some ways to solve this. the only way is: when the header file need to reparsed, the associated cpp file will forced to reparse again.