summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/lsan/lsan_common.cc
diff options
context:
space:
mode:
authorAlexey Samsonov <vonosmas@gmail.com>2015-02-17 18:50:30 +0000
committerAlexey Samsonov <vonosmas@gmail.com>2015-02-17 18:50:30 +0000
commit79df18703451f0445a1c5a2ccbc47597666e9d0c (patch)
tree5cacd05a8f2a1e93d8915b7003cb50e0a3d60349 /compiler-rt/lib/lsan/lsan_common.cc
parent7a9afba9ade731f285ac98bc8695a6ec1cf8340d (diff)
downloadbcm5719-llvm-79df18703451f0445a1c5a2ccbc47597666e9d0c.tar.gz
bcm5719-llvm-79df18703451f0445a1c5a2ccbc47597666e9d0c.zip
[LSan] Make parent tool responsible for initializing LSan flags.
Summary: LSan can be combined with a parent tool (for now it's only ASan). Also, we allow LSAN_OPTIONS to override certain common flags. It means we have to parse LSAN_OPTIONS early enough, before the rest of the parent tool (including chunks of sanitizer_common) is initialized. In future, we can use the same approach for UBSan, after we embed it into ASan runtime in a similar way. Test Plan: regression test suite Reviewers: earthdok, eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D7577 llvm-svn: 229519
Diffstat (limited to 'compiler-rt/lib/lsan/lsan_common.cc')
-rw-r--r--compiler-rt/lib/lsan/lsan_common.cc38
1 files changed, 2 insertions, 36 deletions
diff --git a/compiler-rt/lib/lsan/lsan_common.cc b/compiler-rt/lib/lsan/lsan_common.cc
index 7b3cd163976..5a2f25cf896 100644
--- a/compiler-rt/lib/lsan/lsan_common.cc
+++ b/compiler-rt/lib/lsan/lsan_common.cc
@@ -43,46 +43,13 @@ void Flags::SetDefaults() {
#undef LSAN_FLAG
}
-static void RegisterLsanFlags(FlagParser *parser, Flags *f) {
+void RegisterLsanFlags(FlagParser *parser, Flags *f) {
#define LSAN_FLAG(Type, Name, DefaultValue, Description) \
RegisterFlag(parser, #Name, Description, &f->Name);
#include "lsan_flags.inc"
#undef LSAN_FLAG
}
-static void InitializeFlags(bool standalone) {
- Flags *f = flags();
- FlagParser parser;
- RegisterLsanFlags(&parser, f);
- RegisterCommonFlags(&parser);
-
- f->SetDefaults();
-
- // Set defaults for common flags (only in standalone mode) and parse
- // them from LSAN_OPTIONS.
- if (standalone) {
- SetCommonFlagsDefaults();
- CommonFlags cf;
- cf.CopyFrom(*common_flags());
- cf.external_symbolizer_path = GetEnv("LSAN_SYMBOLIZER_PATH");
- cf.malloc_context_size = 30;
- cf.detect_leaks = true;
- OverrideCommonFlags(cf);
- }
-
- bool help_before = common_flags()->help;
-
- const char *options = GetEnv("LSAN_OPTIONS");
- parser.ParseString(options);
-
- SetVerbosity(common_flags()->verbosity);
-
- if (Verbosity()) ReportUnrecognizedFlags();
-
- if (!help_before && common_flags()->help)
- parser.PrintFlagDescriptions();
-}
-
#define LOG_POINTERS(...) \
do { \
if (flags()->log_pointers) Report(__VA_ARGS__); \
@@ -116,8 +83,7 @@ void InitializeRootRegions() {
root_regions = new(placeholder) InternalMmapVector<RootRegion>(1);
}
-void InitCommonLsan(bool standalone) {
- InitializeFlags(standalone);
+void InitCommonLsan() {
InitializeRootRegions();
if (common_flags()->detect_leaks) {
// Initialization which can fail or print warnings should only be done if
OpenPOWER on IntegriCloud