blob: 61f0def594d88ab326167a30e9b2641af324248a [file] [log] [blame]
Artem Dergachev78692ea2016-08-02 12:21:09 +00001// RUN: %clang_cc1 -analyze -std=c++11 -analyzer-checker=alpha.clone.CloneChecker -verify %s
2
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}