diff options
author | Alexander Potapenko <glider@google.com> | 2014-03-20 12:52:52 +0000 |
---|---|---|
committer | Alexander Potapenko <glider@google.com> | 2014-03-20 12:52:52 +0000 |
commit | 177ff3686224736fdedfb7c34716259adf595fb4 (patch) | |
tree | 77ec8c1777f0b1c73a361916fcdfc87fc8d88f80 /lib/sanitizer_common/sanitizer_flags.h | |
parent | cd32e71d7db63332ef950499c1739c424ae5e789 (diff) |
[libsanitizer] Introduce flag descriptions.
Extend ParseFlag to accept the |description| parameter, add dummy values for all existing flags.
As the flags are parsed their descriptions are stored in a global linked list.
The tool can later call __sanitizer::PrintFlagDescriptions() to dump all the flag names and their descriptions.
Add the 'help' flag and make ASan, TSan and MSan print the flags if 'help' is set to 1.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@204339 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_flags.h')
-rw-r--r-- | lib/sanitizer_common/sanitizer_flags.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/sanitizer_common/sanitizer_flags.h b/lib/sanitizer_common/sanitizer_flags.h index 94d695461..670428ba3 100644 --- a/lib/sanitizer_common/sanitizer_flags.h +++ b/lib/sanitizer_common/sanitizer_flags.h @@ -18,10 +18,14 @@ namespace __sanitizer { -void ParseFlag(const char *env, bool *flag, const char *name); -void ParseFlag(const char *env, int *flag, const char *name); -void ParseFlag(const char *env, uptr *flag, const char *name); -void ParseFlag(const char *env, const char **flag, const char *name); +void ParseFlag(const char *env, bool *flag, + const char *name, const char *descr); +void ParseFlag(const char *env, int *flag, + const char *name, const char *descr); +void ParseFlag(const char *env, uptr *flag, + const char *name, const char *descr); +void ParseFlag(const char *env, const char **flag, + const char *name, const char *descr); struct CommonFlags { // If set, use the online symbolizer from common sanitizer runtime to turn @@ -80,6 +84,8 @@ struct CommonFlags { const char *color; // Enables support for dynamic libraries linked with libpthread 2.2.5. bool legacy_pthread_cond; + // Print help and exit. + bool help; }; inline CommonFlags *common_flags() { @@ -89,6 +95,7 @@ inline CommonFlags *common_flags() { void SetCommonFlagsDefaults(CommonFlags *f); void ParseCommonFlagsFromString(CommonFlags *f, const char *str); +void PrintFlagDescriptions(); } // namespace __sanitizer |