[PATCH] D59220: [asan] Add options -asan-detect-invalid-pointer-cmp and -asan-detect-invalid-pointer-sub options.

Matt Morehouse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 26 09:37:44 PDT 2019


morehouse added inline comments.


================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:575
+                   bool UseAfterScope = false, bool InvalidPointerCmp = false,
+                   bool InvalidPointerSub = false)
+      : UseAfterScope(UseAfterScope || ClUseAfterScope),
----------------
These parameter lists are getting too long.  Do we need to store the options or can we just check `ClInvalidPointer*` instead?  Or, can we use an options struct?


================
Comment at: test/Instrumentation/AddressSanitizer/asan-detect-invalid-pointer-pair.ll:2
+; RUN: opt < %s -asan -asan-detect-invalid-pointer-cmp -S \
+; RUN:     | FileCheck %s -check-prefix=CMP -check-prefix=NOSUB
+; RUN: opt < %s -asan -asan-detect-invalid-pointer-sub -S \
----------------
I think we can do `--check-prefixes=CMP,NOSUB`.


================
Comment at: test/Instrumentation/AddressSanitizer/asan-detect-invalid-pointer-pair.ll:12
+define i32 @mycmp(i8* %p, i8* %q) sanitize_address {
+; ALL-LABEL: @mycmp
+; NOCMP-NOT: call void @__sanitizer_ptr_cmp
----------------
Do we also need to add `--check-prefix=ALL`?


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59220/new/

https://reviews.llvm.org/D59220





More information about the llvm-commits mailing list