clang  8.0.0svn
LangOptions.cpp
Go to the documentation of this file.
1 //===- LangOptions.cpp - C Language Family Language Options ---------------===//
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 //===----------------------------------------------------------------------===//
13 
15 
16 using namespace clang;
17 
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 }
23 
25 #define LANGOPT(Name, Bits, Default, Description)
26 #define BENIGN_LANGOPT(Name, Bits, Default, Description) Name = Default;
27 #define BENIGN_ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
28  Name = Default;
29 #include "clang/Basic/LangOptions.def"
30 
31  // These options do not affect AST generation.
35 
36  CurrentModule.clear();
37  IsHeaderFile = false;
38 }
39 
40 bool LangOptions::isNoBuiltinFunc(StringRef FuncName) const {
41  for (unsigned i = 0, e = NoBuiltinFuncs.size(); i != e; ++i)
42  if (FuncName.equals(NoBuiltinFuncs[i]))
43  return true;
44  return false;
45 }
46 
47 VersionTuple LangOptions::getOpenCLVersionTuple() const {
48  const int Ver = OpenCLCPlusPlus ? OpenCLCPlusPlusVersion : OpenCLVersion;
49  return VersionTuple(Ver / 100, (Ver % 100) / 10);
50 }
bool isNoBuiltinFunc(StringRef Name) const
Is this a libc/libm function that is no longer recognized as a builtin because a -fno-builtin-* optio...
Definition: LangOptions.cpp:40
std::vector< std::string > XRayAlwaysInstrumentFiles
Paths to the XRay "always instrument" files specifying which objects (files, functions, variables) should be imbued with the XRay "always instrument" attribute.
Definition: LangOptions.h:160
void resetNonModularOptions()
Reset all of the options that are not considered when building a module.
Definition: LangOptions.cpp:24
VersionTuple getOpenCLVersionTuple() const
Return the OpenCL C or C++ version as a VersionTuple.
Definition: LangOptions.cpp:47
std::string CurrentModule
The name of the current module, of which the main source file is a part.
Definition: LangOptions.h:191
Defines the clang::LangOptions interface.
Dataflow Directional Tag Classes.
bool IsHeaderFile
Indicates whether the front-end is explicitly told that the input is a header file (i...
Definition: LangOptions.h:215
std::vector< std::string > XRayNeverInstrumentFiles
Paths to the XRay "never instrument" files specifying which objects (files, functions, variables) should be imbued with the XRay "never instrument" attribute.
Definition: LangOptions.h:166
std::vector< std::string > NoBuiltinFuncs
A list of all -fno-builtin-* function names (e.g., memset).
Definition: LangOptions.h:203
std::vector< std::string > SanitizerBlacklistFiles
Paths to blacklist files specifying which objects (files, functions, variables) should not be instrum...
Definition: LangOptions.h:154