Home | History | Annotate | Download | only in TestCases
      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 *;
     16     fprintf(stderr, "Test alloc p: %p.\n", p);
     17   }
     18   *p = malloc(666);
     19   void *q = malloc(1337);
     20   fprintf(stderr, "Test alloc q: %p.\n", q);
     21   return 0;
     22 }
     23 
     24 // CHECK: Test alloc p: [[ADDR:.*]].
     25 // CHECK-NOT: [[ADDR]]
     26