]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/Analysis/exercise-ps.c
Vendor import of clang release_30 branch r142614:
[FreeBSD/FreeBSD.git] / test / Analysis / exercise-ps.c
1 // RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.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
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();
18 static void f2(void *buf) {
19   F12_typedef* x;
20   x = f2_helper();
21   memcpy((&x[1]), (buf), 1); // expected-warning{{implicitly declaring C library function 'memcpy' with type 'void *(void *, const void *}} \
22   // expected-note{{please include the header <string.h> or explicitly provide a declaration for 'memcpy'}}
23 }