blob: 1d93469aa3c2f62983c3b1fc63004c81ae8767b8 [file] [log] [blame]
Raphael Isemann561f0de2017-09-04 05:56:36 +00001// RUN: %clang_analyze_cc1 -triple x86_64-unknown-linux -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
5int foo1(int src) {
6 int dst = src;
7 if (src < 100 && src > 0) {
8
9 asm ("mov %1, %0\n\t"
10 "add $1, %0"
11 : "=r" (dst)
12 : "r" (src));
13
14 }
15 return dst;
16}
17
18// Identical to foo1 except that it adds two instead of one, so it's no clone.
19int foo2(int src) {
20 int dst = src;
21 if (src < 100 && src > 0) {
22
23 asm ("mov %1, %0\n\t"
24 "add $2, %0"
25 : "=r" (dst)
26 : "r" (src));
27
28 }
29 return dst;
30}
31
32// Identical to foo1 except that its a volatile asm statement, so it's no clone.
33int foo3(int src) {
34 int dst = src;
35 if (src < 100 && src > 0) {
36
37 asm volatile ("mov %1, %0\n\t"
38 "add $1, %0"
39 : "=r" (dst)
40 : "r" (src));
41
42 }
43 return dst;
44}