Eugene Zelenko | 25cae5a2 | 2018-02-16 23:40:07 +0000 | [diff] [blame] | 1 | //===- LangOptions.cpp - C Language Family Language Options ---------------===// |
Douglas Gregor | 79a9141 | 2011-09-13 17:21:33 +0000 | [diff] [blame] | 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 | //===----------------------------------------------------------------------===// |
Eugene Zelenko | 25cae5a2 | 2018-02-16 23:40:07 +0000 | [diff] [blame] | 13 | |
Douglas Gregor | 79a9141 | 2011-09-13 17:21:33 +0000 | [diff] [blame] | 14 | #include "clang/Basic/LangOptions.h" |
| 15 | |
| 16 | using namespace clang; |
| 17 | |
Eugene Zelenko | 25cae5a2 | 2018-02-16 23:40:07 +0000 | [diff] [blame] | 18 | LangOptions::LangOptions() { |
Douglas Gregor | 79a9141 | 2011-09-13 17:21:33 +0000 | [diff] [blame] | 19 | #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 Gregor | f1312a8 | 2011-09-13 20:44:41 +0000 | [diff] [blame] | 23 | |
| 24 | void LangOptions::resetNonModularOptions() { |
| 25 | #define LANGOPT(Name, Bits, Default, Description) |
| 26 | #define BENIGN_LANGOPT(Name, Bits, Default, Description) Name = Default; |
Douglas Gregor | 8455e76 | 2011-09-15 14:56:27 +0000 | [diff] [blame] | 27 | #define BENIGN_ENUM_LANGOPT(Name, Type, Bits, Default, Description) \ |
| 28 | Name = Default; |
| 29 | #include "clang/Basic/LangOptions.def" |
Will Dietz | f54319c | 2013-01-18 11:30:38 +0000 | [diff] [blame] | 30 | |
Vedant Kumar | 85a83c2 | 2017-06-01 20:01:01 +0000 | [diff] [blame] | 31 | // These options do not affect AST generation. |
Alexey Samsonov | a511cdd | 2015-02-04 17:40:08 +0000 | [diff] [blame] | 32 | SanitizerBlacklistFiles.clear(); |
Dean Michael Berris | 835832d | 2017-03-30 00:29:36 +0000 | [diff] [blame] | 33 | XRayAlwaysInstrumentFiles.clear(); |
| 34 | XRayNeverInstrumentFiles.clear(); |
Will Dietz | f54319c | 2013-01-18 11:30:38 +0000 | [diff] [blame] | 35 | |
Douglas Gregor | 7d106e4 | 2011-11-15 19:35:01 +0000 | [diff] [blame] | 36 | CurrentModule.clear(); |
Erik Verbruggen | e0bde75 | 2016-10-27 14:17:10 +0000 | [diff] [blame] | 37 | IsHeaderFile = false; |
Douglas Gregor | f1312a8 | 2011-09-13 20:44:41 +0000 | [diff] [blame] | 38 | } |
| 39 | |
Mehdi Amini | ce2da5e | 2016-10-10 16:34:07 +0000 | [diff] [blame] | 40 | bool LangOptions::isNoBuiltinFunc(StringRef FuncName) const { |
Chad Rosier | 7dbc9cf | 2016-01-06 14:35:46 +0000 | [diff] [blame] | 41 | 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 Haastregt | 35b6139 | 2018-05-08 13:47:43 +0000 | [diff] [blame] | 46 | |
| 47 | VersionTuple LangOptions::getOpenCLVersionTuple() const { |
| 48 | const int Ver = OpenCLCPlusPlus ? OpenCLCPlusPlusVersion : OpenCLVersion; |
| 49 | return VersionTuple(Ver / 100, (Ver % 100) / 10); |
| 50 | } |