clang静态分析器:未生成路径诊断报告

时间:2018-03-03 23:17:53

标签: c++ clang clang-static-analyzer

这是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问题 报告?

0 个答案:

没有答案