Static Analysis for Qt Objects and containers?
Unsolved
General and Desktop
-
I have a very simple example that refuses to be flagged by either clang, clang-tidy, clazy, or Krazy2.
QVector<int> myVec; myVec.push_back(1); myVec.push_back(2); int third = myVec.at(3); int otherThird =myVec[3];
obviously this segfaults because there was never a third element.
The issue is that no single IDE or plugin will flag this. It'll ASSERT in Qt Creator debug build run but that's after it compiles.
there has to be some intellisense like thing in the editor or any static analysis tool that can read Qt Containers.
"Just add the Qt source to your code model" you might say well compiling every single part of Qt takes many days so not an option.
Another example is
QCheckBox *myCheckbox = new QCheckBox(); QListView *myListView = qobject_cast<QListView *>(myCheckBox); //will equal null QSize size = myListView->gridSize(); //myListView is null so crashes with segfault again
This leads to deep bugs that aren't flagged with any static analysis tool.
Any advice please on how to find these bugs?