1 // RUN: %clang_analyze_cc1 -std=c++11 -verify %s \
2 // RUN: -analyzer-checker=core \
3 // RUN: -analyzer-checker=cplusplus.NewDelete \
4 // RUN: -analyzer-checker=unix.MismatchedDeallocator
6 // RUN: %clang_analyze_cc1 -std=c++11 -verify %s \
7 // RUN: -analyzer-checker=core \
8 // RUN: -analyzer-checker=cplusplus.NewDelete \
9 // RUN: -analyzer-checker=cplusplus.NewDeleteLeaks \
10 // RUN: -analyzer-checker=unix.MismatchedDeallocator
12 // expected-no-diagnostics
14 typedef __typeof(sizeof(int)) size_t;
18 //------------------------------------------------------------------
19 // Check that alpha.cplusplus.NewDelete + unix.MismatchedDeallocator
20 // does not enable warnings produced by the unix.Malloc checker.
21 //------------------------------------------------------------------
22 void testMallocFreeNoWarn() {
26 int *p1
= (int *)malloc(sizeof(int));
27 free(++p1
); // no warn
29 int *p2
= (int *)malloc(sizeof(int));
33 int *p3
= (int *)malloc(sizeof(int)); // no warn
35 int *p4
= (int *)malloc(sizeof(int));
37 int j
= *p4
; // no warn