Daniel Dunbar | ffd408a | 2009-03-24 02:24:46 +0000 | [diff] [blame^] | 1 | // RUN: clang-cc -analyze -checker-simple -analyzer-store=region -verify %s && |
| 2 | // RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify -triple x86_64-apple-darwin9 %s && |
| 3 | // RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify -triple i686-apple-darwin9 %s |
Zhongxing Xu | 5f09732 | 2009-03-03 00:28:42 +0000 | [diff] [blame] | 4 | |
| 5 | void f1() { |
| 6 | int a[10]; |
| 7 | int *p = a; |
| 8 | ++p; |
| 9 | } |
Zhongxing Xu | 3ae9f34 | 2009-03-11 07:43:49 +0000 | [diff] [blame] | 10 | |
| 11 | char* foo(); |
| 12 | |
| 13 | void f2() { |
| 14 | char *p = foo(); |
| 15 | ++p; |
| 16 | } |
Zhongxing Xu | 768b9d6 | 2009-03-11 09:15:38 +0000 | [diff] [blame] | 17 | |
Zhongxing Xu | eca6524 | 2009-03-12 01:55:38 +0000 | [diff] [blame] | 18 | // This test case checks if we get the right rvalue type of a TypedViewRegion. |
| 19 | // The ElementRegion's type depends on the array region's rvalue type. If it was |
| 20 | // a pointer type, we would get a loc::SymbolVal for '*p'. |
Zhongxing Xu | 768b9d6 | 2009-03-11 09:15:38 +0000 | [diff] [blame] | 21 | char* memchr(); |
| 22 | static int |
| 23 | domain_port (const char *domain_b, const char *domain_e, |
| 24 | const char **domain_e_ptr) |
| 25 | { |
| 26 | int port = 0; |
| 27 | |
| 28 | const char *p; |
| 29 | const char *colon = memchr (domain_b, ':', domain_e - domain_b); |
| 30 | |
| 31 | for (p = colon + 1; p < domain_e ; p++) |
| 32 | port = 10 * port + (*p - '0'); |
| 33 | return port; |
| 34 | } |