2018-02-16 23:40:07 +00:00
|
|
|
//===- LangOptions.cpp - C Language Family Language Options ---------------===//
|
2011-09-13 17:21:33 +00:00
|
|
|
//
|
2019-01-19 08:50:56 +00:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2011-09-13 17:21:33 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file defines the LangOptions class.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2018-02-16 23:40:07 +00:00
|
|
|
|
2011-09-13 17:21:33 +00:00
|
|
|
#include "clang/Basic/LangOptions.h"
|
|
|
|
|
|
|
|
using namespace clang;
|
|
|
|
|
2018-02-16 23:40:07 +00:00
|
|
|
LangOptions::LangOptions() {
|
2011-09-13 17:21:33 +00:00
|
|
|
#define LANGOPT(Name, Bits, Default, Description) Name = Default;
|
|
|
|
#define ENUM_LANGOPT(Name, Type, Bits, Default, Description) set##Name(Default);
|
|
|
|
#include "clang/Basic/LangOptions.def"
|
|
|
|
}
|
2011-09-13 20:44:41 +00:00
|
|
|
|
|
|
|
void LangOptions::resetNonModularOptions() {
|
|
|
|
#define LANGOPT(Name, Bits, Default, Description)
|
|
|
|
#define BENIGN_LANGOPT(Name, Bits, Default, Description) Name = Default;
|
2011-09-15 14:56:27 +00:00
|
|
|
#define BENIGN_ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
|
|
|
|
Name = Default;
|
|
|
|
#include "clang/Basic/LangOptions.def"
|
2013-01-18 11:30:38 +00:00
|
|
|
|
2017-06-01 20:01:01 +00:00
|
|
|
// These options do not affect AST generation.
|
2015-02-04 17:40:08 +00:00
|
|
|
SanitizerBlacklistFiles.clear();
|
2017-03-30 00:29:36 +00:00
|
|
|
XRayAlwaysInstrumentFiles.clear();
|
|
|
|
XRayNeverInstrumentFiles.clear();
|
2013-01-18 11:30:38 +00:00
|
|
|
|
2011-11-15 19:35:01 +00:00
|
|
|
CurrentModule.clear();
|
2016-10-27 14:17:10 +00:00
|
|
|
IsHeaderFile = false;
|
2011-09-13 20:44:41 +00:00
|
|
|
}
|
|
|
|
|
2016-10-10 16:34:07 +00:00
|
|
|
bool LangOptions::isNoBuiltinFunc(StringRef FuncName) const {
|
2016-01-06 14:35:46 +00:00
|
|
|
for (unsigned i = 0, e = NoBuiltinFuncs.size(); i != e; ++i)
|
|
|
|
if (FuncName.equals(NoBuiltinFuncs[i]))
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
2018-05-08 13:47:43 +00:00
|
|
|
|
|
|
|
VersionTuple LangOptions::getOpenCLVersionTuple() const {
|
|
|
|
const int Ver = OpenCLCPlusPlus ? OpenCLCPlusPlusVersion : OpenCLVersion;
|
|
|
|
return VersionTuple(Ver / 100, (Ver % 100) / 10);
|
|
|
|
}
|