6

I am using clang-tidy from cmdline clang-tidy readability-implicit-bool-conversion ... <other_options>". This clang-tidy option has the sub-option AllowPointerConditions, in order for clang-tidy to allow me to use if (!p) whithot warnings.

https://clang.llvm.org/extra/clang-tidy/checks/readability-implicit-bool-conversion.html

How can I enable this from the command line? thanks

Taw
  • 479
  • 3
  • 15

2 Answers2

8

Use the -config option and put the additional options into CheckOptions.

clang-tidy -config="{Checks: '-*,readability-implicit-bool-conversion', 
  CheckOptions: [{key: readability-implicit-bool-conversion.AllowPointerConditions, value: 1} ]}" 
  test.cpp -- -std=c++11
pablo285
  • 2,460
  • 4
  • 14
  • 38
0

If you are using a .clang-tidy yaml configuration file this is how you set check options

FormatStyle: file
Checks: >
  # all enabled or disabled checks ...
CheckOptions:
  - key: readability-implicit-bool-conversion.AllowPointerConditions
    value: 1
  - key: readability-function-cognitive-complexity.Threshold
    value: 10
  - key: readability-function-cognitive-complexity.IgnoreMacros
    value: true

Philip Nelson
  • 1,027
  • 12
  • 28