summaryrefslogtreecommitdiffstats
path: root/lib/Basic
diff options
context:
space:
mode:
authorAlexey Samsonov <vonosmas@gmail.com>2014-10-30 19:33:44 +0000
committerAlexey Samsonov <vonosmas@gmail.com>2014-10-30 19:33:44 +0000
commit845eee38deb08e4f8935aecc7b280cbaeb7edd10 (patch)
treecf9f7714eb3d128eb8476320ebb6bae287abfcec /lib/Basic
parent16b770cc78954ac7388012fcf02155437fd1c281 (diff)
Get rid of SanitizerOptions::Disabled global. NFC.
SanitizerOptions is not even a POD now, so having global variable of this type, is not nice. Instead, provide a regular constructor and clear() method, and let each CodeGenFunction has its own copy of SanitizerOptions it uses. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220920 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic')
-rw-r--r--lib/Basic/LangOptions.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/Basic/LangOptions.cpp b/lib/Basic/LangOptions.cpp
index ae1c799224..f7ea16a451 100644
--- a/lib/Basic/LangOptions.cpp
+++ b/lib/Basic/LangOptions.cpp
@@ -14,14 +14,21 @@
using namespace clang;
-const SanitizerOptions SanitizerOptions::Disabled = {};
+SanitizerOptions::SanitizerOptions() {
+#define SANITIZER(NAME, ID) ID = 0;
+#include "clang/Basic/Sanitizers.def"
+ SanitizeAddressFieldPadding = 0;
+}
+
+void SanitizerOptions::clear() {
+ SanitizerOptions Default;
+ *this = std::move(Default);
+}
LangOptions::LangOptions() {
#define LANGOPT(Name, Bits, Default, Description) Name = Default;
#define ENUM_LANGOPT(Name, Type, Bits, Default, Description) set##Name(Default);
#include "clang/Basic/LangOptions.def"
-
- Sanitize = SanitizerOptions::Disabled;
}
void LangOptions::resetNonModularOptions() {
@@ -33,7 +40,7 @@ void LangOptions::resetNonModularOptions() {
// FIXME: This should not be reset; modules can be different with different
// sanitizer options (this affects __has_feature(address_sanitizer) etc).
- Sanitize = SanitizerOptions::Disabled;
+ Sanitize.clear();
CurrentModule.clear();
ImplementationOfModule.clear();