blob: 34840c7b7c58261868684a45324858e3f492eac3 [file] [log] [blame]
Daniel Dunbarffd408a2009-03-24 02:24:46 +00001// 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 Xu5f097322009-03-03 00:28:42 +00004
5void f1() {
6 int a[10];
7 int *p = a;
8 ++p;
9}
Zhongxing Xu3ae9f342009-03-11 07:43:49 +000010
11char* foo();
12
13void f2() {
14 char *p = foo();
15 ++p;
16}
Zhongxing Xu768b9d62009-03-11 09:15:38 +000017
Zhongxing Xueca65242009-03-12 01:55:38 +000018// 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'.
Eli Friedman69d7d6f2009-06-04 19:35:30 +000021void* memchr();
Zhongxing Xu768b9d62009-03-11 09:15:38 +000022static int
23domain_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}