blob: edcf44ae6fc0ab5c354036efc276021c4c62d17a [file] [log] [blame]
Raphael Isemann561f0de2017-09-04 05:56:36 +00001// RUN: %clang_analyze_cc1 -fcxx-exceptions -std=c++1z -analyzer-checker=alpha.clone.CloneChecker -analyzer-config alpha.clone.CloneChecker:MinimumCloneComplexity=10 -verify %s
Artem Dergachev78692ea2016-08-02 12:21:09 +00002
3// expected-no-diagnostics
4
5bool foo1(int x) {
6 if (x > 0)
7 return false;
8 else if (x < 0)
9 try { x--; } catch (int i) {}
10 return true;
11}
12
13// Uses parenthesis instead of type
14bool foo2(int x) {
15 if (x > 0)
16 return false;
17 else if (x < 0)
18 try { x--; } catch (...) {}
19 return true;
20}
21
22// Catches a different type (long instead of int)
23bool foo3(int x) {
24 if (x > 0)
25 return false;
26 else if (x < 0)
27 try { x--; } catch (long i) {}
28 return true;
29}