blob: c8a774311efe1fe47054801f639d1c5ff69860ef [file] [log] [blame]
Douglas Gregor79a91412011-09-13 17:21:33 +00001//===--- 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"
Chad Rosier7dbc9cf2016-01-06 14:35:46 +000014#include "llvm/ADT/StringRef.h"
Douglas Gregor79a91412011-09-13 17:21:33 +000015
16using namespace clang;
17
Erik Verbruggene0bde752016-10-27 14:17:10 +000018LangOptions::LangOptions()
19 : IsHeaderFile(false) {
Douglas Gregor79a91412011-09-13 17:21:33 +000020#define LANGOPT(Name, Bits, Default, Description) Name = Default;
21#define ENUM_LANGOPT(Name, Type, Bits, Default, Description) set##Name(Default);
22#include "clang/Basic/LangOptions.def"
23}
Douglas Gregorf1312a82011-09-13 20:44:41 +000024
25void LangOptions::resetNonModularOptions() {
26#define LANGOPT(Name, Bits, Default, Description)
27#define BENIGN_LANGOPT(Name, Bits, Default, Description) Name = Default;
Douglas Gregor8455e762011-09-15 14:56:27 +000028#define BENIGN_ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
29 Name = Default;
30#include "clang/Basic/LangOptions.def"
Will Dietzf54319c2013-01-18 11:30:38 +000031
Richard Smithfc567462013-02-07 01:09:29 +000032 // FIXME: This should not be reset; modules can be different with different
33 // sanitizer options (this affects __has_feature(address_sanitizer) etc).
Alexey Samsonov035462c2014-10-30 19:33:44 +000034 Sanitize.clear();
Alexey Samsonova511cdd2015-02-04 17:40:08 +000035 SanitizerBlacklistFiles.clear();
Dean Michael Berris835832d2017-03-30 00:29:36 +000036 XRayAlwaysInstrumentFiles.clear();
37 XRayNeverInstrumentFiles.clear();
Will Dietzf54319c2013-01-18 11:30:38 +000038
Douglas Gregor7d106e42011-11-15 19:35:01 +000039 CurrentModule.clear();
Erik Verbruggene0bde752016-10-27 14:17:10 +000040 IsHeaderFile = false;
Douglas Gregorf1312a82011-09-13 20:44:41 +000041}
42
Mehdi Aminice2da5e2016-10-10 16:34:07 +000043bool LangOptions::isNoBuiltinFunc(StringRef FuncName) const {
Chad Rosier7dbc9cf2016-01-06 14:35:46 +000044 for (unsigned i = 0, e = NoBuiltinFuncs.size(); i != e; ++i)
45 if (FuncName.equals(NoBuiltinFuncs[i]))
46 return true;
47 return false;
48}