]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/clang/lib/Basic/LangOptions.cpp
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm-project / clang / lib / Basic / LangOptions.cpp
1 //===- LangOptions.cpp - C Language Family Language Options ---------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 //  This file defines the LangOptions class.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #include "clang/Basic/LangOptions.h"
14
15 using namespace clang;
16
17 LangOptions::LangOptions() {
18 #define LANGOPT(Name, Bits, Default, Description) Name = Default;
19 #define ENUM_LANGOPT(Name, Type, Bits, Default, Description) set##Name(Default);
20 #include "clang/Basic/LangOptions.def"
21 }
22
23 void LangOptions::resetNonModularOptions() {
24 #define LANGOPT(Name, Bits, Default, Description)
25 #define BENIGN_LANGOPT(Name, Bits, Default, Description) Name = Default;
26 #define BENIGN_ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
27   Name = Default;
28 #include "clang/Basic/LangOptions.def"
29
30   // These options do not affect AST generation.
31   SanitizerBlacklistFiles.clear();
32   XRayAlwaysInstrumentFiles.clear();
33   XRayNeverInstrumentFiles.clear();
34
35   CurrentModule.clear();
36   IsHeaderFile = false;
37 }
38
39 bool LangOptions::isNoBuiltinFunc(StringRef FuncName) const {
40   for (unsigned i = 0, e = NoBuiltinFuncs.size(); i != e; ++i)
41     if (FuncName.equals(NoBuiltinFuncs[i]))
42       return true;
43   return false;
44 }
45
46 VersionTuple LangOptions::getOpenCLVersionTuple() const {
47   const int Ver = OpenCLCPlusPlus ? OpenCLCPlusPlusVersion : OpenCLVersion;
48   return VersionTuple(Ver / 100, (Ver % 100) / 10);
49 }