Artem Dergachev | 13b2026 | 2018-01-17 23:46:13 +0000 | [diff] [blame] | 1 | // RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection,unix.Malloc -analyzer-config c++-allocator-inlining=true -std=c++11 -verify %s |
| 2 | |
| 3 | void clang_analyzer_eval(bool); |
| 4 | |
| 5 | typedef __typeof__(sizeof(int)) size_t; |
| 6 | |
| 7 | void *malloc(size_t size); |
| 8 | |
| 9 | void *operator new(size_t size) throw() { |
| 10 | void *x = malloc(size); |
| 11 | if (!x) |
| 12 | return nullptr; |
| 13 | return x; |
| 14 | } |
| 15 | |
| 16 | void checkNewAndConstructorInlining() { |
| 17 | int *s = new int; |
| 18 | } // expected-warning {{Potential leak of memory pointed to by 's'}} |