Search code examples
clang-tidy

Setting a sub-option to clang-tidy


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


Solution

  • 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