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