diff options
author | Alexey Samsonov <vonosmas@gmail.com> | 2015-01-07 00:38:00 +0000 |
---|---|---|
committer | Alexey Samsonov <vonosmas@gmail.com> | 2015-01-07 00:38:00 +0000 |
commit | 8bb699b511904af2acc7188db146f29da94022da (patch) | |
tree | 8d6072816a80284eb43e5499cd10f23afa604fcf /lib/dfsan/dfsan.cc | |
parent | df867df2d3da7451984333ebcb6b4040dbcda164 (diff) |
[Sanitizer] Change the runtime flag representation.
This mirrors r225239 to all the rest sanitizers:
ASan, DFSan, LSan, MSan, TSan, UBSan.
Now the runtime flag type, name, default value and
description is located in the single place in the
.inc file.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@225327 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/dfsan/dfsan.cc')
-rw-r--r-- | lib/dfsan/dfsan.cc | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/lib/dfsan/dfsan.cc b/lib/dfsan/dfsan.cc index 941edc5eb..72abee7ef 100644 --- a/lib/dfsan/dfsan.cc +++ b/lib/dfsan/dfsan.cc @@ -310,16 +310,22 @@ dfsan_dump_labels(int fd) { } } +void Flags::SetDefaults() { +#define DFSAN_FLAG(Type, Name, DefaultValue, Description) Name = DefaultValue; +#include "dfsan_flags.inc" +#undef DFSAN_FLAG +} + +void Flags::ParseFromString(const char *str) { +#define DFSAN_FLAG(Type, Name, DefaultValue, Description) \ + ParseFlag(str, &Name, #Name, Description); +#include "dfsan_flags.inc" +#undef DFSAN_FLAG +} + static void InitializeFlags(Flags &f, const char *env) { - f.warn_unimplemented = true; - f.warn_nonzero_labels = false; - f.strict_data_dependencies = true; - f.dump_labels_at_exit = ""; - - ParseFlag(env, &f.warn_unimplemented, "warn_unimplemented", ""); - ParseFlag(env, &f.warn_nonzero_labels, "warn_nonzero_labels", ""); - ParseFlag(env, &f.strict_data_dependencies, "strict_data_dependencies", ""); - ParseFlag(env, &f.dump_labels_at_exit, "dump_labels_at_exit", ""); + f.SetDefaults(); + f.ParseFromString(env); } static void dfsan_fini() { |