blob: 763ba33683bcd95db18e26fa6a2768715746f608 [file] [log] [blame]
Eugene Zelenko25cae5a22018-02-16 23:40:07 +00001//===- LangOptions.cpp - C Language Family Language Options ---------------===//
Douglas Gregor79a91412011-09-13 17:21:33 +00002//
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//===----------------------------------------------------------------------===//
Eugene Zelenko25cae5a22018-02-16 23:40:07 +000013
Douglas Gregor79a91412011-09-13 17:21:33 +000014#include "clang/Basic/LangOptions.h"
15
16using namespace clang;
17
Eugene Zelenko25cae5a22018-02-16 23:40:07 +000018LangOptions::LangOptions() {
Douglas Gregor79a91412011-09-13 17:21:33 +000019#define LANGOPT(Name, Bits, Default, Description) Name = Default;
20#define ENUM_LANGOPT(Name, Type, Bits, Default, Description) set##Name(Default);
21#include "clang/Basic/LangOptions.def"
22}
Douglas Gregorf1312a82011-09-13 20:44:41 +000023
24void LangOptions::resetNonModularOptions() {
25#define LANGOPT(Name, Bits, Default, Description)
26#define BENIGN_LANGOPT(Name, Bits, Default, Description) Name = Default;
Douglas Gregor8455e762011-09-15 14:56:27 +000027#define BENIGN_ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
28 Name = Default;
29#include "clang/Basic/LangOptions.def"
Will Dietzf54319c2013-01-18 11:30:38 +000030
Vedant Kumar85a83c22017-06-01 20:01:01 +000031 // These options do not affect AST generation.
Alexey Samsonova511cdd2015-02-04 17:40:08 +000032 SanitizerBlacklistFiles.clear();
Dean Michael Berris835832d2017-03-30 00:29:36 +000033 XRayAlwaysInstrumentFiles.clear();
34 XRayNeverInstrumentFiles.clear();
Will Dietzf54319c2013-01-18 11:30:38 +000035
Douglas Gregor7d106e42011-11-15 19:35:01 +000036 CurrentModule.clear();
Erik Verbruggene0bde752016-10-27 14:17:10 +000037 IsHeaderFile = false;
Douglas Gregorf1312a82011-09-13 20:44:41 +000038}
39
Mehdi Aminice2da5e2016-10-10 16:34:07 +000040bool LangOptions::isNoBuiltinFunc(StringRef FuncName) const {
Chad Rosier7dbc9cf2016-01-06 14:35:46 +000041 for (unsigned i = 0, e = NoBuiltinFuncs.size(); i != e; ++i)
42 if (FuncName.equals(NoBuiltinFuncs[i]))
43 return true;
44 return false;
45}
Sven van Haastregt35b61392018-05-08 13:47:43 +000046
47VersionTuple LangOptions::getOpenCLVersionTuple() const {
48 const int Ver = OpenCLCPlusPlus ? OpenCLCPlusPlusVersion : OpenCLVersion;
49 return VersionTuple(Ver / 100, (Ver % 100) / 10);
50}