1 //===--- LangOptions.cpp - C Language Family Language Options ---*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 //  This file defines the LangOptions class.
11 //
12 //===----------------------------------------------------------------------===//
13 #include "clang/Basic/LangOptions.h"
14 
15 using namespace clang;
16 
17 SanitizerOptions::SanitizerOptions() {
18 #define SANITIZER(NAME, ID) ID = 0;
19 #include "clang/Basic/Sanitizers.def"
20   SanitizeAddressFieldPadding = 0;
21 }
22 
23 void SanitizerOptions::clear() {
24   SanitizerOptions Default;
25   *this = std::move(Default);
26 }
27 
28 LangOptions::LangOptions() {
29 #define LANGOPT(Name, Bits, Default, Description) Name = Default;
30 #define ENUM_LANGOPT(Name, Type, Bits, Default, Description) set##Name(Default);
31 #include "clang/Basic/LangOptions.def"
32 }
33 
34 void LangOptions::resetNonModularOptions() {
35 #define LANGOPT(Name, Bits, Default, Description)
36 #define BENIGN_LANGOPT(Name, Bits, Default, Description) Name = Default;
37 #define BENIGN_ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
38   Name = Default;
39 #include "clang/Basic/LangOptions.def"
40 
41   // FIXME: This should not be reset; modules can be different with different
42   // sanitizer options (this affects __has_feature(address_sanitizer) etc).
43   Sanitize.clear();
44 
45   CurrentModule.clear();
46   ImplementationOfModule.clear();
47 }
48 
49