Bug 375240

Summary: The warnings don't show up in Qt Creator
Product: [Developer tools] clazy Reporter: nicolas.kniebihler
Component: generalAssignee: Sergio Martins <smartins>
Status: RESOLVED NOT A BUG    
Severity: normal CC: nicolas.kniebihler, smartins
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: MacPorts   
OS: macOS   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Kit settings screenshot
Compiler settings screenshot

Description nicolas.kniebihler 2017-01-18 14:36:39 UTC
On Mac OS X, with Qt Creator 4.2.0, the clazy warnings don't show up in the "Issues" tab, nor in the "Compile output" tab.
The only way to see clazy warnings is to call "make" from the command line.
Comment 1 Sergio Martins 2017-01-18 19:19:14 UTC
Not sure if this should instead be filed in Qt Creator bug tracker, needs investigation first.
Comment 2 Sergio Martins 2017-01-29 17:10:49 UTC
Can you compile this simple program:

#include <QFileInfo>

int main()
{
    QFileInfo("foo").exists();
    return 0;
}

and paste here the "Compile output tab" ?
Comment 3 nicolas.kniebihler 2017-01-30 11:30:14 UTC
Here it is:

12:26:50: Exécution des étapes pour le projet test...
12:26:50: Débute : "/Users/nkniebilher/Qt/5.6/clang_64/bin/qmake" /Users/nkniebilher/Documents/test/test.pro -spec macx-clang CONFIG+=debug CONFIG+=x86_64 CONFIG+=qml_debug
Info: creating stash file /Users/nkniebilher/Documents/build-test-Desktop_Qt_5_6_2_clang_64bit-Debug/.qmake.stash
12:26:52: Le processus "/Users/nkniebilher/Qt/5.6/clang_64/bin/qmake" s'est terminé normalement.
12:26:52: Débute : "/usr/bin/make" qmake_all
make: Nothing to be done for `qmake_all'.
12:26:52: Le processus "/usr/bin/make" s'est terminé normalement.
12:26:52: Débute : "/usr/bin/make" 
/usr/local/bin/clazy -c -pipe -stdlib=libc++ -g -Xclang -plugin-arg-clang-lazy -Xclang level0,level1 -std=gnu++11 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.7 -Wall -W -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_CORE_LIB -I../test -I. -I../../../Qt/5.6/clang_64/lib/QtCore.framework/Headers -I. -I../../../Qt/5.6/clang_64/mkspecs/macx-clang -F/Users/nkniebilher/Qt/5.6/clang_64/lib -o main.o ../test/main.cpp
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -headerpad_max_install_names -stdlib=libc++ -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.7 -Wl,-rpath,/Users/nkniebilher/Qt/5.6/clang_64/lib -o test main.o   -F/Users/nkniebilher/Qt/5.6/clang_64/lib -framework QtCore -framework DiskArbitration -framework IOKit 
12:27:02: Le processus "/usr/bin/make" s'est terminé normalement.
12:27:02: Temps écoulé : 00:12.
Comment 4 Sergio Martins 2017-03-04 16:37:14 UTC
Can you printscreen QtCreator's dialog for your Kit settings and Compiler settings ?
Comment 5 nicolas.kniebihler 2017-03-06 09:11:32 UTC
Created attachment 104397 [details]
Kit settings screenshot
Comment 6 nicolas.kniebihler 2017-03-06 09:11:59 UTC
Created attachment 104398 [details]
Compiler settings screenshot
Comment 7 nicolas.kniebihler 2017-03-06 09:13:43 UTC
With "QMAKE_CXX = clazy" in the .pro
Comment 8 nicolas.kniebihler 2017-03-06 09:15:49 UTC
In fact it's "QMAKE_CXX = /usr/local/bin/clazy"
Comment 9 Sergio Martins 2017-03-06 20:32:57 UTC
clazy calls clang

I think when you run clazy through QtCreator it calls Apple clang, which doesn't support plugins, while on the command line it's using non-Apple clang.

There might be some differences regarding PATH, and I think QtCreator adds the compiler from the Kit you're using to PATH.

Can you try:

QMAKE_CXX = <complete path to non-Apple clang>
QMAKE_CXXFLAGS += -Xclang -load -Xclang ClangLazy.dylib -Xclang -add-plugin -Xclang clang-lazy
Comment 10 nicolas.kniebihler 2017-03-07 12:55:51 UTC
Yeah! It worked!! :D
It also works with:

QMAKE_CXX = export CLANGXX=/opt/local/bin/clang++; /usr/local/bin/clazy

It was a difficult one to find!
Do you know a way to add a clazy kit? This way, it would be possible to build with clazy without having to change the .pro file...
Comment 11 Sergio Martins 2017-03-07 13:27:02 UTC
No, it doesn't seem possible.
We would need a clazy mkspec for that.
Comment 12 nicolas.kniebihler 2017-03-07 13:40:42 UTC
Yeah I came to the same conclusion after trying some things.
Anyway, thank you for your time!
Comment 13 Sergio Martins 2017-03-07 13:49:27 UTC
For Qt 5.9 or 5.10 I'm hoping to have CONFIG += clazy option
Comment 14 nicolas.kniebihler 2017-03-07 13:57:56 UTC
That would be great! :D