Community
Participate
Working Groups
It seems you cannot follow includes in inactive code paths. Steps to reproduce: 1. Create a new C++ project, with files test.cpp and test.hpp. 2. Add the following code to test.cpp: #ifdef SOME_UNDEFINED_SYMBOL #include "test.hpp" #endif 3. Right-click on "test.hpp" and click "Open Declaration". Nothing happens. I don't see why includes in inactive code paths should be treated different from includes in active code paths.
This can be implemented in a similar way to what I did for bug 507285: since the inactive include gets a C model element (IInclude) created for it, we can have Open Declaration do the same thing that double-clicking on that element in the Outline View does.
New Gerrit change created: https://git.eclipse.org/r/86699
The patch in comment 2 attempts to implement this, but it's not complete yet. I'd like to restrict the IInclude resolution to the case where the include is in inactive code, rather than doing it in all cases where the include failed to resolve via the AST.
(In reply to Nathan Ridge from comment #3) > The patch in comment 2 attempts to implement this, but it's not complete > yet. I'd like to restrict the IInclude resolution to the case where the > include is in inactive code, rather than doing it in all cases where the > include failed to resolve via the AST. This turned out to be very easy to do. The updated patch should now be in good shape.
Gerrit change https://git.eclipse.org/r/86699 was merged to [master]. Commit: http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=4e7f132020439df84567c3669b75dcfead56e70f
Fixed for 9.3.
Mentioned this in the 9.3 N&N: https://wiki.eclipse.org/CDT/User/NewIn93#Following_includes_in_inactive_code_paths