Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Analysis / copypaste / fold.cpp
blobfadcb49fa0b3a55e350ffca432d6caa617628b29
1 // RUN: %clang_analyze_cc1 -std=c++1z -analyzer-checker=alpha.clone.CloneChecker -analyzer-config alpha.clone.CloneChecker:MinimumCloneComplexity=10 -verify %s
3 // expected-no-diagnostics
5 int global = 0;
7 template<typename ...Args>
8 int foo1(Args&&... args) {
9 if (global > 0)
10 return 0;
11 else if (global < 0)
12 return (args + ...);
13 return 1;
16 // Different opeator in fold expression.
17 template<typename ...Args>
18 int foo2(Args&&... args) {
19 if (global > 0)
20 return 0;
21 else if (global < 0)
22 return (args - ...);
23 return 1;
26 // Parameter pack on a different side
27 template<typename ...Args>
28 int foo3(Args&&... args) {
29 if (global > 0)
30 return 0;
31 else if (global < 0)
32 return -1;
33 return (... + args);
34 return 1;