#ifdef section and parsing

Dear CLion devs,

first of all: you've done really a great job! I like CLion alot! Probably because I'm used to IDEA for Java and I was always using CMake :)

I'd like to make 2 suggestions abour #ifdef .. #endif sections.
1. Right now the code parsing is turned off if one is inside a section where the #ifdef clause is not fulfilled (for example the corresponding compiler flag not set).
It would be very nice if code parsing would still be turned on and take into account all declarations outside + declarations from other #ifdef sections
with same conditions.

2. Some information window or field in structure view indicating what type of #ifdef conditions have to be fulfilled so that the current code section is compiled.
e.g. (WIN32 or !WIN32 or "WIN32 && XXX"). Depending on project, sometimes #ifdef sections can be very long and it's nice to see at one glance in which
one you are. (or would that be too much of parsing done by CLion?)



Hi Dirk,

Parsing both branches of an ifdef section is a quite difficult task, plust it is only possible in certain cases where ifdef does not break the syntax. We have a related issue on our tracker, but it's very unlikely that this feature will make it into 1.0.

The idea with somehow indicating which defines affect selecting the current branch sounds interesting, please create a feature request on our tracker. By the way, the "Quick documentation" action from the View menu might be helpful here as well: it shows what the current macro definition resolves into.


Still seeing this in 2017.1.3


This problem is NOT YET gone in 2017.2.3


Fixed it by inserting `include_directories` into CMake for a project that uses `autoconf` instead.


Please sign in to leave a comment.