5

This is a 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";
        });
}

This is my 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)

If I run clang-analyzer against it:

$ 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
    }
    ^

What I can not understand is this:

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

But scan-build have no --analyzer-output, how can I include qtimer.h problem into report?

Bsquare ℬℬ
  • 4,423
  • 11
  • 24
  • 44
user1244932
  • 7,352
  • 5
  • 46
  • 103
  • Have the same problem with ["checker-279.tar.bz2 (built November 14, 2016)"](https://clang-analyzer.llvm.org/) for MacOS. Moreover "-o" flag does not work. I have resolved my problem by using never `scan-build` from llvm package (`brew install llvm`) with the following additional args: `-o ./report -plist-html`. – Unsacrificed Jun 01 '18 at 20:54
  • 1
    @Unsacrificed I migrate to generation json compilation database and gather stderr from clang-analyzer that handles json compilation database. – user1244932 Jun 01 '18 at 21:29

0 Answers0