1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.Malloc,unix.MismatchedDeallocator -analyzer-store region -std=c++11 -verify %s 2*f4a2713aSLionel Sambuc // expected-no-diagnostics 3*f4a2713aSLionel Sambuc 4*f4a2713aSLionel Sambuc typedef __typeof(sizeof(int)) size_t; 5*f4a2713aSLionel Sambuc void *malloc(size_t); 6*f4a2713aSLionel Sambuc void free(void *); 7*f4a2713aSLionel Sambuc 8*f4a2713aSLionel Sambuc //-------------------------------------------------------------------- 9*f4a2713aSLionel Sambuc // Check that unix.Malloc + unix.MismatchedDeallocator does not enable 10*f4a2713aSLionel Sambuc // warnings produced by the alpha.cplusplus.NewDelete checker. 11*f4a2713aSLionel Sambuc //-------------------------------------------------------------------- testNewDeleteNoWarn()12*f4a2713aSLionel Sambucvoid testNewDeleteNoWarn() { 13*f4a2713aSLionel Sambuc int i; 14*f4a2713aSLionel Sambuc delete &i; // no-warning 15*f4a2713aSLionel Sambuc 16*f4a2713aSLionel Sambuc int *p1 = new int; 17*f4a2713aSLionel Sambuc delete ++p1; // no-warning 18*f4a2713aSLionel Sambuc 19*f4a2713aSLionel Sambuc int *p2 = new int; 20*f4a2713aSLionel Sambuc delete p2; 21*f4a2713aSLionel Sambuc delete p2; // no-warning 22*f4a2713aSLionel Sambuc 23*f4a2713aSLionel Sambuc int *p3 = new int; // no-warning 24*f4a2713aSLionel Sambuc 25*f4a2713aSLionel Sambuc int *p4 = new int; 26*f4a2713aSLionel Sambuc delete p4; 27*f4a2713aSLionel Sambuc int j = *p4; // no-warning 28*f4a2713aSLionel Sambuc } 29