Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Analysis / copypaste / catch.cpp
blobedcf44ae6fc0ab5c354036efc276021c4c62d17a
1 // RUN: %clang_analyze_cc1 -fcxx-exceptions -std=c++1z -analyzer-checker=alpha.clone.CloneChecker -analyzer-config alpha.clone.CloneChecker:MinimumCloneComplexity=10 -verify %s
3 // expected-no-diagnostics
5 bool foo1(int x) {
6 if (x > 0)
7 return false;
8 else if (x < 0)
9 try { x--; } catch (int i) {}
10 return true;
13 // Uses parenthesis instead of type
14 bool foo2(int x) {
15 if (x > 0)
16 return false;
17 else if (x < 0)
18 try { x--; } catch (...) {}
19 return true;
22 // Catches a different type (long instead of int)
23 bool foo3(int x) {
24 if (x > 0)
25 return false;
26 else if (x < 0)
27 try { x--; } catch (long i) {}
28 return true;