这是Minimal, Complete, and Verifiable example:
#include <QTimer>
#include <QApplication>
#include <QtDebug>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QObject boo;
QTimer::singleShot(0, &boo, []() {
qDebug() << "hi";
});
}
这是我的CMakeLists.txt:
cmake_minimum_required(VERSION 3.10)
find_package(Qt5Widgets REQUIRED)
include_directories(${Qt5Widgets_INCLUDE_DIRS})
add_executable(boo main.cpp)
qt5_use_modules(boo Widgets)
如果我针对它运行clang-analyzer:
$ mkdir build && cd build && scan-build cmake .. && scan-build cmake --build .
...
warning: Path diagnostic report is not generated. Current output format does not support diagnostics that cross file boundaries. Refer to --analyzer-output for valid output formats
In file included from /tmp/boo/main.cpp:1:
In file included from /usr/include/qt/QtCore/QTimer:1:
/usr/include/qt/QtCore/qtimer.h:154:5: warning: Potential memory leak
}
^
我无法理解的是:
warning: Path diagnostic report is not generated. Current output format does not support diagnostics that cross file boundaries. Refer to --analyzer-output for valid output formats
但是scan-build
没有--analyzer-output
,我怎么能包含qtimer.h
问题
报告?