blob: 10467b7248c13c7d49a2cb66dfc44679034af423 [file] [log] [blame]
Dominic Chen184c6242017-03-03 18:02:02 +00001// RUN: %clang_analyze_cc1 -fblocks -std=c++11 -analyzer-checker=alpha.clone.CloneChecker -verify %s
Artem Dergachevba816322016-07-26 18:13:12 +00002
3// This tests if we search for clones in blocks.
4
5void log();
6
Artem Dergachev4eca0de2016-10-08 10:54:30 +00007auto BlockA = ^(int a, int b){ // expected-warning{{Duplicate code detected}}
Artem Dergachevba816322016-07-26 18:13:12 +00008 log();
9 if (a > b)
10 return a;
11 return b;
12};
13
Artem Dergachev4eca0de2016-10-08 10:54:30 +000014auto BlockB = ^(int a, int b){ // expected-note{{Similar code here}}
Artem Dergachevba816322016-07-26 18:13:12 +000015 log();
16 if (a > b)
17 return a;
18 return b;
19};