Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Analysis / copypaste / sub-sequences.cpp
blobd2c08350ab4c24c5b053302e9e11a5825011842e
1 // RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=alpha.clone.CloneChecker -analyzer-config alpha.clone.CloneChecker:MinimumCloneComplexity=10 -verify %s
3 // This tests if sub-sequences can match with normal sequences.
5 void log2(int a);
6 void log();
8 int max(int a, int b) {
9 log2(a);
10 log(); // expected-warning{{Duplicate code detected}}
11 if (a > b)
12 return a;
13 return b;
16 int maxClone(int a, int b) {
17 log(); // expected-note{{Similar code here}}
18 if (a > b)
19 return a;
20 return b;
23 // Functions below are not clones and should not be reported.
25 int foo(int a, int b) { // no-warning
26 return a + b;