1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,cplusplus.NewDelete,unix.MismatchedDeallocator -std=c++11 -verify %s
2 // RUN: %clang_analyze_cc1 -analyzer-checker=core,cplusplus.NewDelete,cplusplus.NewDeleteLeaks,unix.MismatchedDeallocator -DLEAKS -std=c++11 -verify %s
3 // expected-no-diagnostics
5 typedef __typeof(sizeof(int)) size_t;
9 //------------------------------------------------------------------
10 // Check that alpha.cplusplus.NewDelete + unix.MismatchedDeallocator
11 // does not enable warnings produced by the unix.Malloc checker.
12 //------------------------------------------------------------------
13 void testMallocFreeNoWarn() {
17 int *p1 = (int *)malloc(sizeof(int));
18 free(++p1); // no warn
20 int *p2 = (int *)malloc(sizeof(int));
24 int *p3 = (int *)malloc(sizeof(int)); // no warn
26 int *p4 = (int *)malloc(sizeof(int));
28 int j = *p4; // no warn