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

David Schulz David.Schulz at qt.io
Mon Aug 14 14:11:38 CEST 2023


Hiho,

Thanks for the investigation. This was broken by the attempt to fix the save state handling, but ultimately made it worse. Good news is that the fix for that issue went into 11.0.2 which just got released.
So I would like to encourage you to test Qt Creator 11.0.2 and check whether it improves the state handling for you.

Greetings
David

From: Qt-creator <qt-creator-bounces at qt-project.org> On Behalf Of Wiebe Cazemier via Qt-creator
Sent: 8 August, 2023 16:40
To: QtCreator List <qt-creator at qt-project.org>
Subject: [Qt-creator] Code model / static analyzer with changed working copies incorrect

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/20230814/20a09164/attachment.htm>


More information about the Qt-creator mailing list