]> granicus.if.org Git - clang/commit
[asan] Turn -fsanitize-address-use-after-scope on by default [clang part]
authorKuba Mracek <mracek@apple.com>
Fri, 31 Mar 2017 03:00:09 +0000 (03:00 +0000)
committerKuba Mracek <mracek@apple.com>
Fri, 31 Mar 2017 03:00:09 +0000 (03:00 +0000)
commit5442164add72e96b623b56d870690ee790383447
treedae462b77b47360c6ef07a8ed7b84b767bdc1304
parentf4d6c2a6ccd56aab8d5ad4d8ca5f3cfa656f4b89
[asan] Turn -fsanitize-address-use-after-scope on by default [clang part]

AddressSanitizer has an optional compile-time flag, -fsanitize-address-use-after-scope, which enables detection of use-after-scope bugs. We'd like to have this feature on by default, because it is already very well tested, it's used in several projects already (LLVM automatically enables it when using -DLLVM_USE_SANITIZER=Address), it's low overhead and there are no known issues or incompatibilities.

This patch enables use-after-scope by default via the Clang driver, where we set true as the default value for AsanUseAfterScope. This also causes the lifetime markers to be generated whenever fsanitize=address is used. This has some nice consequences, e.g. we now have line numbers for all local variables.

Differential Revision: https://reviews.llvm.org/D31479

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299174 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Driver/SanitizerArgs.h
test/Driver/fsanitize.c