[Qt-creator] Code model / static analyzer with changed working copies incorrect

Wiebe Cazemier wiebe at halfgaar.net
Tue Aug 8 16:39:47 CEST 2023


Hi there, 

For a while now, I've noticed that QtCreator isn't as good as it used to be in parsing code that is not saved to disk. But now with 11.0.1, it's especially bad. It just doesn't seem to update anymore. In 10.0.2 I just had to save all (ctrl-shift-s) the time. In QtCreator 4, which I used for a long time without upgrading (reasons not important), it worked well. This happens on various computers, various projects, all QtCreator versions, freshly installed or settings reset. 

When I do 'Tools -> Debug QtCreator -> inspect c++ code model', I see the working copy of changed files is accurate, but I guess it doesn't use it? 

To reproduce: make CMakeLists.txt, main.cpp and main.h: 

$ cat CMakeLists.txt 
project(analyzer_test) 
add_executable(analyzer_test main.cpp main.h) 


$ cat main.h 
struct foo 
{ 
int b; 
}; 

$ cat main.cpp 
#include "main.h" 

int main() 
{ 
foo f; 
f.a = 4; 
return 0; 
} 

Just open these files in QtCreator and change the struct without saving. Then go back to the .cpp file. It doesn't update, or perhaps only when you save it. 

Tested versions: 10.0.2 and 11.0.1, installed with maintenance tool. 
Ubuntu 20.04.6 LTS 

Regards, 

Wiebe 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20230808/cdba8799/attachment.htm>


More information about the Qt-creator mailing list