summaryrefslogtreecommitdiff
path: root/lib/scudo/scudo_flags.cpp
diff options
context:
space:
mode:
authorKostya Kortchinsky <kostyak@google.com>2017-11-14 16:14:53 +0000
committerKostya Kortchinsky <kostyak@google.com>2017-11-14 16:14:53 +0000
commitd9e8b59cc34bfce8cd1e3d9285df0a8ae0d16021 (patch)
tree6acbcd6e959ea50503e3e54051123b48a11f4b4d /lib/scudo/scudo_flags.cpp
parentde9856b41224c2e7c30d0991d032f5efcf6d43e7 (diff)
downloadcompiler-rt-d9e8b59cc34bfce8cd1e3d9285df0a8ae0d16021.tar.gz
[scudo] Simplify initialization and flags
Summary: This is mostly some cleanup and shouldn't affect functionalities. Reviewing some code for a future addition, I realized that the complexity of the initialization path was unnecessary, and so was maintaining a structure for the allocator options throughout the initialization. So we get rid of that structure, of an extraneous level of nesting for the `init` function, and correct a couple of related code inaccuracies in the flags cpp. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D39974 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@318157 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/scudo/scudo_flags.cpp')
-rw-r--r--lib/scudo/scudo_flags.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/scudo/scudo_flags.cpp b/lib/scudo/scudo_flags.cpp
index ab94afac9..2aff3ef1e 100644
--- a/lib/scudo/scudo_flags.cpp
+++ b/lib/scudo/scudo_flags.cpp
@@ -17,12 +17,11 @@
#include "sanitizer_common/sanitizer_flags.h"
#include "sanitizer_common/sanitizer_flag_parser.h"
-extern "C" SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
-const char* __scudo_default_options();
+SANITIZER_INTERFACE_WEAK_DEF(const char*, __scudo_default_options, void);
namespace __scudo {
-Flags ScudoFlags; // Use via getFlags().
+static Flags ScudoFlags; // Use via getFlags().
void Flags::setDefaults() {
#define SCUDO_FLAG(Type, Name, DefaultValue, Description) Name = DefaultValue;
@@ -37,7 +36,7 @@ static void RegisterScudoFlags(FlagParser *parser, Flags *f) {
#undef SCUDO_FLAG
}
-static const char *callGetScudoDefaultOptions() {
+static const char *getScudoDefaultOptions() {
return (&__scudo_default_options) ? __scudo_default_options() : "";
}
@@ -57,8 +56,7 @@ void initFlags() {
RegisterCommonFlags(&ScudoParser);
// Override from user-specified string.
- const char *ScudoDefaultOptions = callGetScudoDefaultOptions();
- ScudoParser.ParseString(ScudoDefaultOptions);
+ ScudoParser.ParseString(getScudoDefaultOptions());
// Override from environment.
ScudoParser.ParseString(GetEnv("SCUDO_OPTIONS"));