annotate clang/lib/Basic/LangOptions.cpp @ 222:81f6424ef0e3 llvm-original

LLVM original branch
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 18 Jul 2021 22:10:01 +0900 (2021-07-18)
parents 79ff65ed7e25
children c4bab56944e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 //===- LangOptions.cpp - C Language Family Language Options ---------------===//
anatofuz
parents:
diff changeset
2 //
anatofuz
parents:
diff changeset
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
anatofuz
parents:
diff changeset
4 // See https://llvm.org/LICENSE.txt for license information.
anatofuz
parents:
diff changeset
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
anatofuz
parents:
diff changeset
6 //
anatofuz
parents:
diff changeset
7 //===----------------------------------------------------------------------===//
anatofuz
parents:
diff changeset
8 //
anatofuz
parents:
diff changeset
9 // This file defines the LangOptions class.
anatofuz
parents:
diff changeset
10 //
anatofuz
parents:
diff changeset
11 //===----------------------------------------------------------------------===//
anatofuz
parents:
diff changeset
12
anatofuz
parents:
diff changeset
13 #include "clang/Basic/LangOptions.h"
anatofuz
parents:
diff changeset
14
anatofuz
parents:
diff changeset
15 using namespace clang;
anatofuz
parents:
diff changeset
16
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
17 LangOptions::LangOptions() : LangStd(LangStandard::lang_unspecified) {
150
anatofuz
parents:
diff changeset
18 #define LANGOPT(Name, Bits, Default, Description) Name = Default;
anatofuz
parents:
diff changeset
19 #define ENUM_LANGOPT(Name, Type, Bits, Default, Description) set##Name(Default);
anatofuz
parents:
diff changeset
20 #include "clang/Basic/LangOptions.def"
anatofuz
parents:
diff changeset
21 }
anatofuz
parents:
diff changeset
22
anatofuz
parents:
diff changeset
23 void LangOptions::resetNonModularOptions() {
anatofuz
parents:
diff changeset
24 #define LANGOPT(Name, Bits, Default, Description)
anatofuz
parents:
diff changeset
25 #define BENIGN_LANGOPT(Name, Bits, Default, Description) Name = Default;
anatofuz
parents:
diff changeset
26 #define BENIGN_ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
27 Name = static_cast<unsigned>(Default);
150
anatofuz
parents:
diff changeset
28 #include "clang/Basic/LangOptions.def"
anatofuz
parents:
diff changeset
29
anatofuz
parents:
diff changeset
30 // These options do not affect AST generation.
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
31 NoSanitizeFiles.clear();
150
anatofuz
parents:
diff changeset
32 XRayAlwaysInstrumentFiles.clear();
anatofuz
parents:
diff changeset
33 XRayNeverInstrumentFiles.clear();
anatofuz
parents:
diff changeset
34
anatofuz
parents:
diff changeset
35 CurrentModule.clear();
anatofuz
parents:
diff changeset
36 IsHeaderFile = false;
anatofuz
parents:
diff changeset
37 }
anatofuz
parents:
diff changeset
38
anatofuz
parents:
diff changeset
39 bool LangOptions::isNoBuiltinFunc(StringRef FuncName) const {
anatofuz
parents:
diff changeset
40 for (unsigned i = 0, e = NoBuiltinFuncs.size(); i != e; ++i)
anatofuz
parents:
diff changeset
41 if (FuncName.equals(NoBuiltinFuncs[i]))
anatofuz
parents:
diff changeset
42 return true;
anatofuz
parents:
diff changeset
43 return false;
anatofuz
parents:
diff changeset
44 }
anatofuz
parents:
diff changeset
45
anatofuz
parents:
diff changeset
46 VersionTuple LangOptions::getOpenCLVersionTuple() const {
anatofuz
parents:
diff changeset
47 const int Ver = OpenCLCPlusPlus ? OpenCLCPlusPlusVersion : OpenCLVersion;
anatofuz
parents:
diff changeset
48 return VersionTuple(Ver / 100, (Ver % 100) / 10);
anatofuz
parents:
diff changeset
49 }
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
50
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
51 FPOptions FPOptions::defaultWithoutTrailingStorage(const LangOptions &LO) {
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
52 FPOptions result(LO);
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
53 return result;
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
54 }
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
55
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
56 LLVM_DUMP_METHOD void FPOptions::dump() {
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
57 #define OPTION(NAME, TYPE, WIDTH, PREVIOUS) \
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
58 llvm::errs() << "\n " #NAME " " << get##NAME();
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
59 #include "clang/Basic/FPOptions.def"
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
60 llvm::errs() << "\n";
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
61 }
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
62
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
63 LLVM_DUMP_METHOD void FPOptionsOverride::dump() {
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
64 #define OPTION(NAME, TYPE, WIDTH, PREVIOUS) \
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
65 if (has##NAME##Override()) \
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
66 llvm::errs() << "\n " #NAME " Override is " << get##NAME##Override();
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
67 #include "clang/Basic/FPOptions.def"
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
68 llvm::errs() << "\n";
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
69 }