Created attachment 134559 [details] Minimal example Minimal example attached 01:59:44: Starting: "/usr/bin/qmake" /insilications/apps/test/test/test.pro -spec linux-g++ CONFIG+=debug CONFIG-=qml_debug 01:59:44: Starting: "/usr/bin/make" -f /insilications/apps/test/test/Makefile qmake_all 01:59:44: Starting: "/usr/bin/make" -j16 g++ -c -std=c++17 -g -Wall -Wextra -D_REENTRANT -fPIC -DQT_DBUS_LIB -DQT_CORE_LIB -I. -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtDBus -isystem /usr/include/qt5/QtCore -I. -I/usr/lib64/qt5/mkspecs/linux-g++ -o main.o main.cpp g++ -fPIC -o test main.o /usr/lib64/libQt5DBus.so /usr/lib64/libQt5Core.so -lpthread
Analyzing "/insilications/apps/test/test/main.cpp" [Clazy]. Failed to analyze "/insilications/apps/test/test/main.cpp": Clazy crashed. Command line: /usr/bin/clazy-standalone -checks=qproperty-type-mismatch -export-fixes=/tmp/QtCreator-lLYZre/clangtools-StSiPY/report-main.cpp-bWCuFT /insilications/apps/test/test/main.cpp -- -Wno-unknown-pragmas -Wno-unknown-warning-option -Wno-documentation-unknown-command -w -nostdinc -nostdinc++ -std=c++17 -g -D_REENTRANT -fPIC -fsyntax-only -m64 --target=x86_64-generic-linux -x c++ -DQT_DBUS_LIB -DQT_CORE_LIB -I /insilications/apps/test/test -I /usr/include/qt5 -I /usr/include/qt5/QtDBus -I /usr/include/qt5/QtCore -I /usr/lib64/qt5/mkspecs/linux-g++ -isystem /usr/include/c++/10 -isystem /usr/include/c++/10/x86_64-generic-linux -isystem /usr/include/c++/10/backward -isystem /usr/lib64/gcc/x86_64-generic-linux/10/include -isystem /usr/lib64/gcc/x86_64-generic-linux/10/include-fixed -isystem /usr/include -v Process Error: 1 Output: clang version 11.0.0 (https://code.qt.io/clang/llvm-project.git e43a39a3ed2ec0a05638956cdebfd2f7cf164692) Target: x86_64-generic-linux Thread model: posix InstalledDir: Found candidate GCC installation: /../lib64/gcc/x86_64-generic-linux/10 Found candidate GCC installation: /../lib64/gcc/x86_64-generic-linux/7 Found candidate GCC installation: /../lib64/gcc/x86_64-generic-linux/8 Found candidate GCC installation: /../lib64/gcc/x86_64-generic-linux/9 Found candidate GCC installation: /usr/lib64/gcc/x86_64-generic-linux/10 Found candidate GCC installation: /usr/lib64/gcc/x86_64-generic-linux/7 Found candidate GCC installation: /usr/lib64/gcc/x86_64-generic-linux/8 Found candidate GCC installation: /usr/lib64/gcc/x86_64-generic-linux/9 Selected GCC installation: /../lib64/gcc/x86_64-generic-linux/10 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Selected multilib: .;@m64 clang version 11.0.0 (https://code.qt.io/clang/llvm-project.git e43a39a3ed2ec0a05638956cdebfd2f7cf164692) Target: x86_64-generic-linux Thread model: posix InstalledDir: /usr/bin Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-generic-linux/10 Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-generic-linux/7 Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-generic-linux/8 Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-generic-linux/9 Found candidate GCC installation: /usr/lib64/gcc/x86_64-generic-linux/10 Found candidate GCC installation: /usr/lib64/gcc/x86_64-generic-linux/7 Found candidate GCC installation: /usr/lib64/gcc/x86_64-generic-linux/8 Found candidate GCC installation: /usr/lib64/gcc/x86_64-generic-linux/9 Selected GCC installation: /usr/bin/../lib64/gcc/x86_64-generic-linux/10 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Selected multilib: .;@m64 clang Invocation: "/usr/bin/clang-tool" "-cc1" "-triple" "x86_64-generic-linux" "-fsyntax-only" "-disable-free" "-main-file-name" "main.cpp" "-mrelocation-model" "pic" "-pic-level" "2" "-mframe-pointer=all" "-fmath-errno" "-fno-rounding-math" "-mconstructor-aliases" "-munwind-tables" "-target-cpu" "x86-64" "-fno-split-dwarf-inlining" "-debug-info-kind=limited" "-dwarf-version=4" "-debugger-tuning=gdb" "-v" "-nostdsysteminc" "-nobuiltininc" "-resource-dir" "/usr/lib64/clang/11.0.0" "-isystem" "/usr/include/c++/10" "-isystem" "/usr/include/c++/10/x86_64-generic-linux" "-isystem" "/usr/include/c++/10/backward" "-isystem" "/usr/lib64/gcc/x86_64-generic-linux/10/include" "-isystem" "/usr/lib64/gcc/x86_64-generic-linux/10/include-fixed" "-isystem" "/usr/include" "-D" "_REENTRANT" "-D" "QT_DBUS_LIB" "-D" "QT_CORE_LIB" "-I" "/insilications/apps/test/test" "-I" "/usr/include/qt5" "-I" "/usr/include/qt5/QtDBus" "-I" "/usr/include/qt5/QtCore" "-I" "/usr/lib64/qt5/mkspecs/linux-g++" "-Wno-unknown-pragmas" "-Wno-unknown-warning-option" "-Wno-documentation-unknown-command" "-w" "-std=c++17" "-fdeprecated-macro" "-fdebug-compilation-dir" "/tmp/QtCreator-lLYZre/clangtools-StSiPY" "-ferror-limit" "19" "-fgnuc-version=4.2.1" "-fcxx-exceptions" "-fexceptions" "-faddrsig" "-x" "c++" "/insilications/apps/test/test/main.cpp" clang -cc1 version 11.0.0 based upon LLVM 11.0.0 default target x86_64-generic-linux #include "..." search starts here: #include <...> search starts here: /insilications/apps/test/test /usr/include/qt5 /usr/include/qt5/QtDBus /usr/include/qt5/QtCore /usr/lib64/qt5/mkspecs/linux-g++ /usr/include/c++/10 /usr/include/c++/10/x86_64-generic-linux /usr/include/c++/10/backward /usr/lib64/gcc/x86_64-generic-linux/10/include /usr/lib64/gcc/x86_64-generic-linux/10/include-fixed /usr/include End of search list. In file included from /insilications/apps/test/test/main.cpp:1: In file included from /usr/include/qt5/QtCore/QCoreApplication:1: In file included from /usr/include/qt5/QtCore/qcoreapplication.h:43: In file included from /usr/include/qt5/QtCore/qglobal.h:1298: /usr/include/qt5/QtCore/qtypeinfo.h:289:1: warning: Q_PROPERTY 'name' of type 'QString' is mismatched with method 'name' of return type 'constchar*' [-Wclazy-qproperty-type-mismatch] Q_DECLARE_TYPEINFO_BODY(QFlags<T>, Q_PRIMITIVE_TYPE); ^ /usr/include/qt5/QtCore/qtypeinfo.h:279:5: note: expanded from macro 'Q_DECLARE_TYPEINFO_BODY' static inline const char *name() { return #TYPE; } \ ^ clazy-standalone: ../clang/lib/Tooling/Core/Diagnostic.cpp:28: clang::tooling::DiagnosticMessage::DiagnosticMessage(llvm::StringRef, const clang::SourceManager &, clang::SourceLocation): Assertion `Loc.isValid() && Loc.isFileID()' failed. 02:01:55: Error: Failed to analyze 1 files. 02:01:55: Clang-Tidy and Clazy finished: Processed 0 files successfully, 1 failed. 02:01:55: Elapsed time: 00:02.
The proposed patch fixes the issue. DiagnosticMessage indeed received an empty and invalid file location from a macro location. Checking for a macro location now allows DiagnosticMessage to receive a proper file location from an eventual returned macro expansion location.
Created attachment 134560 [details] Minimal example
Created attachment 134561 [details] Proposed patch
https://invent.kde.org/sdk/clazy/-/merge_requests/30
thanks!