0

I'm trying this, but doesn't work:

$ clang-tidy --config="analyzer-max-loop: 10" a.cpp --
<command-line-config>:1:1: error: unknown key 'analyzer-max-loop'
analyzer-max-loop: 10
^~~~~~~~~~~~~~~~~
Error: invalid configuration specified.
Invalid argument

I want the analyzer to try to iterate through a loop 10 times.

yegor256
  • 102,010
  • 123
  • 446
  • 597

1 Answers1

0

This is how it works:

$ clang --analyze -Xclang -analyzer-constraints=z3 \
  -Xclang -analyzer-max-loop -Xclang 10 a.cpp
yegor256
  • 102,010
  • 123
  • 446
  • 597
  • The question specified `clang-tidy`, but this answer is for `clang --analyze`. And did setting this option have any observable effect? – Scott McPeak Apr 08 '23 at 19:04
  • Yes, thanks to this setting clang Clang-TIdy/CSA/Clang (I'm lost) can find a bug in a loop that iterates for more than four times. – yegor256 Apr 10 '23 at 02:16