[PATCH] D37860: [MSan] Enable use-after-dtor instrumentation by default.

Vitaly Buka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 14 13:10:49 PDT 2017


vitalybuka added inline comments.


================
Comment at: clang/include/clang/Driver/Options.td:854
                                      HelpText<"Enable use-after-destroy detection in MemorySanitizer">;
+def fno_sanitize_memory_use_after_dtor : Flag<["-"], "fno-sanitize-memory-use-after-dtor">,
+                                     Group<f_clang_Group>,
----------------
I'd recommend to split patch in two:
1. Add no-sanitize with tests
2. Flip default


================
Comment at: clang/lib/Driver/SanitizerArgs.cpp:492
+    if (Arg *A =
+        Args.getLastArg(options::OPT_fsanitize_memory_use_after_dtor,
+                        options::OPT_fno_sanitize_memory_use_after_dtor)) {
----------------
Can you use parsing similar to AsanUseAfterScope at line 645


================
Comment at: compiler-rt/test/msan/dtor-bit-fields.cc:3
 
-// RUN: %clangxx_msan %s -O1 -fsanitize=memory -fsanitize-memory-use-after-dtor -o %t && MSAN_OPTIONS=poison_in_dtor=1 %run %t
+// RUN: %clangxx_msan %s -O1 -o %t && MSAN_OPTIONS=poison_in_dtor=1 %run %t
 
----------------
Please keep -fsanitize-memory-use-after-dtor in dtor* tests.
We test the check itself here, not default value. So we don't flip it every time default switched.


================
Comment at: compiler-rt/test/msan/use-after-dtor.cc:13
 
 #include <sanitizer/msan_interface.h>
 #include <assert.h>
----------------
Probably we need one test which check that we stop detecting bugs with 
-fno-sanitize-memory-track-origins. Maybe this one or in separate file.


https://reviews.llvm.org/D37860





More information about the cfe-commits mailing list