[Qt-creator] Minimizing compile-time conditionals in Qt Creator

Christian Kandeler christian.kandeler at nokia.com
Tue Aug 28 10:28:34 CEST 2012


On 28/08/12 10:05, ext Konstantin Tokarev wrote:
> 28.08.2012, 11:56, "Christian Kandeler" <christian.kandeler at nokia.com>:
>> However, most of the time that is not the case, such as in
>> this example:
>>       QStringList rc(QLatin1String(".svn"));
>>       #ifdef Q_OS_WIN
>>           rc.push_back(QLatin1String("_svn"));
>>       #endif
>>       return rc;
>> The code would compile on any platform, but we hide it from the compiler
>> and Qt Creator's code model on all of them except Windows. This means
>> that if, for instance, you are developing on Linux and you are using
>> Creator's refactoring support to rename the rc variable in the above
>> example, Creator will miss the occurrence inside the #ifdef'ed block, as
>> that one is not part of the code model.
>
> I think this issues is a fault of Qt Creator. While I understand that it may be
> impossible to parse disabled block completely in some cases (not in this one
> btw), it would be very desirable to support basic things like code navigation and
> variable renaming for disabled blocks too.

This is probably not doable in the general case. For instance, variables 
with the same name might not actually be the "same" due to competing 
declarations etc; presumably the scenarios can get arbitrarily complex 
there. I'm pretty sure the code model people can name all kinds of 
"interesting" effects.


Christian




More information about the Qt-creator mailing list