ptr-arith.c revision e8cba00b40ce8a31e8d2ee6f3ca8243cd1e37719
1// RUN: clang -analyze -checker-simple -analyzer-store=region -verify %s 2 3void f1() { 4 int a[10]; 5 int *p = a; 6 ++p; 7} 8 9char* foo(); 10 11void f2() { 12 char *p = foo(); 13 ++p; 14} 15 16// 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'. 19char* 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} 33