Eclipse call hierarchy skips calls in undefined #ifdef regions
The "call hierarchy" and "declaration" features in Eclipse CDT omit results that exist in undefined (greyed out) 开发者_高级运维#ifdef regions.
Example:
void blah(void) {
#ifndef ABC
foo();
#else //line is greyed out
bar(); //line is greyed out
#endif //line is greyed out
}
The call hierarchy for foo() will list blah() as a caller; the call hierarchy for bar() will not list blah().
I'm not expecting it to do full resolution of which #define blocks will get compiled, I simply would like it to return all calls/declarations of the function I'm searching for, regardless of the #define blocks that surround it.
Other IDEs such as SlickEdit are able to do this.
Does anyone know of a way to get Eclipse to adopt this behavior?
Thanks.
There are many "bugs" opened on the CDT "Call Hierarchy" feature:
- Open call hierarchy doesn't work for constructors.
- Calls to implicit constructors missing
- Call graph for constructors does not work for member variables.
All of them are linked to the binding resolution (also the situation will improve for implicit constructor calls in CDT7.0).
And since bar() is clearly within an Unreachable #ifdef block, chances are the "binding resolution" will ignore it completely.
Hence the incomplete cal hierarchy.
I'm using Eclipse 3.6.2 with PDT 2.x on Windows 7 64Bit Ultimate.
I would expect to see a list of all the places where the method was called from, however I basically only see the declaration of the method itself. Same if I switch to 'callee' hierarchy. Even when the method is called or calls methods in the same file.
精彩评论