Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 1 | // Test for ScopedDisabler. |
| 2 | // RUN: LSAN_BASE="report_objects=1:use_registers=0:use_stacks=0:use_globals=0:use_tls=0" |
| 3 | // RUN: %clangxx_lsan %s -o %t |
| 4 | // RUN: LSAN_OPTIONS=$LSAN_BASE not %run %t 2>&1 | FileCheck %s |
| 5 | |
| 6 | #include <stdio.h> |
| 7 | #include <stdlib.h> |
| 8 | |
| 9 | #include "sanitizer/lsan_interface.h" |
| 10 | |
| 11 | int main() { |
| 12 | void **p; |
| 13 | { |
| 14 | __lsan::ScopedDisabler d; |
| 15 | p = new void *; |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 16 | fprintf(stderr, "Test alloc p: %p.\n", p); |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 17 | } |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 18 | *p = malloc(666); |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 19 | void *q = malloc(1337); |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 20 | fprintf(stderr, "Test alloc q: %p.\n", q); |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 21 | return 0; |
| 22 | } |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 23 | |
| 24 | // CHECK: Test alloc p: [[ADDR:.*]]. |
| 25 | // CHECK-NOT: [[ADDR]] |