20 lines · cpp
1// RUN: %clang_analyze_cc1 -fblocks -std=c++11 -analyzer-checker=alpha.clone.CloneChecker -analyzer-config alpha.clone.CloneChecker:MinimumCloneComplexity=10 -verify %s2 3// This tests if we search for clones in blocks.4 5void log();6 7auto BlockA = ^(int a, int b){ // expected-warning{{Duplicate code detected}}8 log();9 if (a > b)10 return a;11 return b;12};13 14auto BlockB = ^(int a, int b){ // expected-note{{Similar code here}}15 log();16 if (a > b)17 return a;18 return b;19};20