1 // RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.core -analyzer-store=region -verify %s
2 //
3 // Just exercise the analyzer on code that has at one point caused issues
4 // (i.e., no assertions or crashes).
5 
6 
f1(const char * x,char * y)7 static void f1(const char *x, char *y) {
8   while (*x != 0) {
9     *y++ = *x++;
10   }
11 }
12 
13 // This following case checks that we properly handle typedefs when getting
14 // the RvalueType of an ElementRegion.
15 typedef struct F12_struct {} F12_typedef;
16 typedef void* void_typedef;
17 void_typedef f2_helper();
f2(void * buf)18 static void f2(void *buf) {
19   F12_typedef* x;
20   x = f2_helper();
21   memcpy((&x[1]), (buf), 1); // expected-warning{{implicitly declaring library function 'memcpy' with type 'void *(void *, const void *}} \
22   // expected-note{{include the header <string.h> or explicitly provide a declaration for 'memcpy'}}
23 }
24