Details
-
Task
-
Resolution: Done
-
P3: Somewhat important
-
Qt Creator 4.14.0-beta2
-
None
-
-
1a09f816a38cd4672172229971784d6bf9969846 (qt-creator/qt-creator/master)
Description
I wanted to use clang-tidy to detect side effects in Q_ASSERT_X like in:
Q_ASSERT_X(x++ > 0, Q_FUNC_INFO, "x is >= 0!");
I can choose bugprone-assert-side-effect
but this seems to detect 'only' assert but not Q_ASSERT_X.
Following the link: "Web Page" you can read on https://releases.llvm.org/11.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/bugprone-assert-side-effect.html#bugprone-assert-side-effect
But there is no GUI element to set the 'Options'.
It would be great to have a way to set the options.
Work around + suggestion:
Digging some further I finally found how to create a .clang-tidy file and put it in the folder of the source file and set the combo box from 'Select Checks' to 'Use .clang-tidy config file'.
The .clang-tidy file had to be:
Checks: '-*,bugprone-assert-side-effect' CheckOptions: - key: bugprone-assert-side-effect.CheckFunctionCalls value: '1' - key: bugprone-assert-side-effect.AssertMacros value: 'Q_ASSERT_X,Q_ASSERT,assert,assert2,my_assert,convoluted_assert,msvc_assert'
and so:
I'm missing a way to set the CheckOptions ( a list of key - value pairs) in the GUI.
Maybe a column between the check and the link to the web page could have a button to edit options?
At least a button next to 'Edit Checks as String...' on inside of the dialog that creates a dump to have a starting .clang-tidy would be great.
Something like this was started in https://bugreports.qt.io/browse/QTCREATORBUG-23223?jql=project%20%3D%20QTCREATORBUG%20AND%20text%20~%20%22clang-tidy%20CheckOptions%22
resulting to this
https://codereview.qt-project.org/c/qt-creator/qt-creator/+/285656
started by Nikolai Kosjar (now not with Qt anymore) , but with changes under radar (not reviewers).
Attachments
For Gerrit Dashboard: QTCREATORBUG-24977 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
327264,4 | ClangTools: Support clang-tidy check options | master | qt-creator/qt-creator | Status: MERGED | +2 | 0 |