blob: db81507aa209ba048718e069c0bd6ad33c613e84 [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
Vedant Kumar85a83c22017-06-01 20:01:01 +000032 // These options do not affect AST generation.
Alexey Samsonova511cdd2015-02-04 17:40:08 +000033 SanitizerBlacklistFiles.clear();
Dean Michael Berris835832d2017-03-30 00:29:36 +000034 XRayAlwaysInstrumentFiles.clear();
35 XRayNeverInstrumentFiles.clear();
Will Dietzf54319c2013-01-18 11:30:38 +000036
Douglas Gregor7d106e42011-11-15 19:35:01 +000037 CurrentModule.clear();
Erik Verbruggene0bde752016-10-27 14:17:10 +000038 IsHeaderFile = false;
Douglas Gregorf1312a82011-09-13 20:44:41 +000039}
40
Mehdi Aminice2da5e2016-10-10 16:34:07 +000041bool LangOptions::isNoBuiltinFunc(StringRef FuncName) const {
Chad Rosier7dbc9cf2016-01-06 14:35:46 +000042 for (unsigned i = 0, e = NoBuiltinFuncs.size(); i != e; ++i)
43 if (FuncName.equals(NoBuiltinFuncs[i]))
44 return true;
45 return false;
46}