1 | // RUN: %clang_analyze_cc1 -analyzer-output=text -std=c++11 -analyzer-checker=alpha.clone.CloneChecker -analyzer-config alpha.clone.CloneChecker:MinimumCloneComplexity=10 -verify %s |
---|---|
2 | |
3 | void log(); |
4 | |
5 | int max(int a, int b) { // expected-warning{{Duplicate code detected}} // expected-note{{Duplicate code detected}} |
6 | log(); |
7 | if (a > b) |
8 | return a; |
9 | return b; |
10 | } |
11 | |
12 | int maxClone(int a, int b) { // expected-note{{Similar code here}} |
13 | log(); |
14 | if (a > b) |
15 | return a; |
16 | return b; |
17 | } |
18 |