xref: /aosp_15_r20/external/compiler-rt/test/asan/TestCases/lsan_annotations.cc (revision 7c3d14c8b49c529e04be81a3ce6f5cc23712e4c6)
1*7c3d14c8STreehugger Robot // Check that LSan annotations work fine.
2*7c3d14c8STreehugger Robot // RUN: %clangxx_asan -O0 %s -o %t && %run %t
3*7c3d14c8STreehugger Robot // RUN: %clangxx_asan -O3 %s -o %t && %run %t
4*7c3d14c8STreehugger Robot 
5*7c3d14c8STreehugger Robot #include <sanitizer/lsan_interface.h>
6*7c3d14c8STreehugger Robot #include <stdlib.h>
7*7c3d14c8STreehugger Robot 
main()8*7c3d14c8STreehugger Robot int main() {
9*7c3d14c8STreehugger Robot   int *x = new int;
10*7c3d14c8STreehugger Robot   __lsan_ignore_object(x);
11*7c3d14c8STreehugger Robot   {
12*7c3d14c8STreehugger Robot     __lsan::ScopedDisabler disabler;
13*7c3d14c8STreehugger Robot     double *y = new double;
14*7c3d14c8STreehugger Robot   }
15*7c3d14c8STreehugger Robot   return 0;
16*7c3d14c8STreehugger Robot }
17