[all-commits] [llvm/llvm-project] 4c39f3: [SanitizerCommon] Print the current value of optio...
danliew via All-commits
all-commits at lists.llvm.org
Thu Nov 14 14:05:07 PST 2019
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 4c39f341996cea2fd8619fc14c8c66ab567744fb
https://github.com/llvm/llvm-project/commit/4c39f341996cea2fd8619fc14c8c66ab567744fb
Author: Dan Liew <dan at su-root.co.uk>
Date: 2019-11-14 (Thu, 14 Nov 2019)
Changed paths:
M compiler-rt/lib/msan/msan.cpp
M compiler-rt/lib/sanitizer_common/sanitizer_flag_parser.cpp
M compiler-rt/lib/sanitizer_common/sanitizer_flag_parser.h
M compiler-rt/lib/sanitizer_common/sanitizer_flags.cpp
M compiler-rt/test/sanitizer_common/TestCases/options-help.cpp
Log Message:
-----------
[SanitizerCommon] Print the current value of options when printing out help.
Summary:
Previously it wasn't obvious what the default value of various sanitizer
options were. A very close approximation of the "default values" for the
options are the current value of the options at the time of printing the
help output.
In the case that no other options are provided then the current values
are the default values (apart from `help`).
```
ASAN_OPTIONS=help=1 ./program
```
This patch causes the current option values to be printed when the
`help` output is enabled. The original intention for this patch was to append
`(Default: <value>)` to an option's help text. However because this
is technically wrong (and misleading) I've opted to append
`(Current Value: <value>)` instead.
When trying to implement a way of displaying the default value of the
options I tried another solution where the default value used in `*.inc` files
were used to create compile time strings that where used when printing
the help output. This solution was not satisfactory for several reasons:
* Stringifying the default values with the preprocessor did not work very
well in several cases. Some options contain boolean operators which no
amount of macro expansion can get rid of.
* It was much more invasive than this patch. Every sanitizer had to be changed.
* The settings of `__<sanitizer>_default_options()` are ignored.
For those reasons I opted for the solution in this patch.
rdar://problem/42567204
Reviewers: kubamracek, yln, kcc, dvyukov, vitalybuka, cryptoad, eugenis, samsonov
Subscribers: #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D69546
More information about the All-commits
mailing list