blob: 11c8708dcf29ffe6d5bb839aed228564671d7c3e [file] [log] [blame]
Zhongxing Xu5f097322009-03-03 00:28:42 +00001// RUN: clang -analyze -checker-simple -analyzer-store=region -verify %s
2
3void f1() {
4 int a[10];
5 int *p = a;
6 ++p;
7}
Zhongxing Xu3ae9f342009-03-11 07:43:49 +00008
9char* foo();
10
11void f2() {
12 char *p = foo();
13 ++p;
14}
Zhongxing Xu768b9d62009-03-11 09:15:38 +000015
Zhongxing Xueca65242009-03-12 01:55:38 +000016// This test case checks if we get the right rvalue type of a TypedViewRegion.
17// The ElementRegion's type depends on the array region's rvalue type. If it was
18// a pointer type, we would get a loc::SymbolVal for '*p'.
Zhongxing Xu768b9d62009-03-11 09:15:38 +000019char* memchr();
20static int
21domain_port (const char *domain_b, const char *domain_e,
22 const char **domain_e_ptr)
23{
24 int port = 0;
25
26 const char *p;
27 const char *colon = memchr (domain_b, ':', domain_e - domain_b);
28
29 for (p = colon + 1; p < domain_e ; p++)
30 port = 10 * port + (*p - '0');
31 return port;
32}