summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_flags.cc
diff options
context:
space:
mode:
authorAlexey Samsonov <vonosmas@gmail.com>2015-01-02 21:28:37 +0000
committerAlexey Samsonov <vonosmas@gmail.com>2015-01-02 21:28:37 +0000
commit5445e3a45fb91761c7be96a35b9cdc7194881ccd (patch)
tree547504987ce7b2ff55d399d57d22fe78c3b52327 /lib/sanitizer_common/sanitizer_flags.cc
parentee2d9890ccbda9ef229eeacc8ede3dd365284f4c (diff)
downloadcompiler-rt-5445e3a45fb91761c7be96a35b9cdc7194881ccd.tar.gz
Revert "Revert r224736: "[Sanitizer] Make CommonFlags immutable after initialization.""
Fix test failures by introducing CommonFlags::CopyFrom() to make sure compiler doesn't insert memcpy() calls into runtime code. Original commit message: Protect CommonFlags singleton by adding const qualifier to common_flags() accessor. The only ways to modify the flags are SetCommonFlagsDefaults(), ParseCommonFlagsFromString() and OverrideCommonFlags() functions, which are only supposed to be called during initialization. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@225088 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_flags.cc')
-rw-r--r--lib/sanitizer_common/sanitizer_flags.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/sanitizer_common/sanitizer_flags.cc b/lib/sanitizer_common/sanitizer_flags.cc
index 3b1ec70fb..684938e44 100644
--- a/lib/sanitizer_common/sanitizer_flags.cc
+++ b/lib/sanitizer_common/sanitizer_flags.cc
@@ -187,6 +187,10 @@ void CommonFlags::ParseFromString(const char *str) {
malloc_context_size = 1;
}
+void CommonFlags::CopyFrom(const CommonFlags &other) {
+ internal_memcpy(this, &other, sizeof(*this));
+}
+
static bool GetFlagValue(const char *env, const char *name,
const char **value, int *value_length) {
if (env == 0)