26 #include "llvm/ADT/APFloat.h"
27 #include "llvm/Support/FileSystem.h"
28 #include "llvm/Support/MemoryBuffer.h"
29 #include "llvm/Support/Path.h"
30 using namespace clang;
33 while (!MacroBody.empty() &&
isWhitespace(MacroBody.back()))
34 MacroBody = MacroBody.drop_back();
35 return !MacroBody.empty() && MacroBody.back() ==
'\\';
43 std::pair<StringRef, StringRef> MacroPair = Macro.split(
'=');
44 StringRef MacroName = MacroPair.first;
45 StringRef MacroBody = MacroPair.second;
46 if (MacroName.size() != Macro.size()) {
48 StringRef::size_type
End = MacroBody.find_first_of(
"\n\r");
49 if (End != StringRef::npos)
50 Diags.
Report(diag::warn_fe_macro_contains_embedded_newline)
52 MacroBody = MacroBody.substr(0, End);
57 Builder.
defineMacro(MacroName, Twine(MacroBody) +
"\\\n");
71 Builder.
append(Twine(
"#include \"") + File +
"\"");
75 Builder.
append(Twine(
"#__include_macros \"") + File +
"\"");
83 StringRef ImplicitIncludePTH) {
90 << ImplicitIncludePTH;
101 StringRef ImplicitIncludePCH) {
102 std::string OriginalFile =
105 if (OriginalFile.empty())
113 template <
typename T>
114 static T
PickFP(
const llvm::fltSemantics *Sem, T IEEESingleVal,
115 T IEEEDoubleVal, T X87DoubleExtendedVal, T PPCDoubleDoubleVal,
117 if (Sem == (
const llvm::fltSemantics*)&llvm::APFloat::IEEEsingle)
118 return IEEESingleVal;
119 if (Sem == (
const llvm::fltSemantics*)&llvm::APFloat::IEEEdouble)
120 return IEEEDoubleVal;
121 if (Sem == (
const llvm::fltSemantics*)&llvm::APFloat::x87DoubleExtended)
122 return X87DoubleExtendedVal;
123 if (Sem == (
const llvm::fltSemantics*)&llvm::APFloat::PPCDoubleDouble)
124 return PPCDoubleDoubleVal;
125 assert(Sem == (
const llvm::fltSemantics*)&llvm::APFloat::IEEEquad);
130 const llvm::fltSemantics *Sem, StringRef Ext) {
131 const char *DenormMin, *Epsilon, *Max, *Min;
132 DenormMin =
PickFP(Sem,
"1.40129846e-45",
"4.9406564584124654e-324",
133 "3.64519953188247460253e-4951",
134 "4.94065645841246544176568792868221e-324",
135 "6.47517511943802511092443895822764655e-4966");
136 int Digits =
PickFP(Sem, 6, 15, 18, 31, 33);
137 int DecimalDigits =
PickFP(Sem, 9, 17, 21, 33, 36);
138 Epsilon =
PickFP(Sem,
"1.19209290e-7",
"2.2204460492503131e-16",
139 "1.08420217248550443401e-19",
140 "4.94065645841246544176568792868221e-324",
141 "1.92592994438723585305597794258492732e-34");
142 int MantissaDigits =
PickFP(Sem, 24, 53, 64, 106, 113);
143 int Min10Exp =
PickFP(Sem, -37, -307, -4931, -291, -4931);
144 int Max10Exp =
PickFP(Sem, 38, 308, 4932, 308, 4932);
145 int MinExp =
PickFP(Sem, -125, -1021, -16381, -968, -16381);
146 int MaxExp =
PickFP(Sem, 128, 1024, 16384, 1024, 16384);
147 Min =
PickFP(Sem,
"1.17549435e-38",
"2.2250738585072014e-308",
148 "3.36210314311209350626e-4932",
149 "2.00416836000897277799610805135016e-292",
150 "3.36210314311209350626267781732175260e-4932");
151 Max =
PickFP(Sem,
"3.40282347e+38",
"1.7976931348623157e+308",
152 "1.18973149535723176502e+4932",
153 "1.79769313486231580793728971405301e+308",
154 "1.18973149535723176508575932662800702e+4932");
161 Builder.
defineMacro(DefPrefix +
"DENORM_MIN__", Twine(DenormMin)+Ext);
163 Builder.
defineMacro(DefPrefix +
"DIG__", Twine(Digits));
164 Builder.
defineMacro(DefPrefix +
"DECIMAL_DIG__", Twine(DecimalDigits));
165 Builder.
defineMacro(DefPrefix +
"EPSILON__", Twine(Epsilon)+Ext);
167 Builder.
defineMacro(DefPrefix +
"HAS_QUIET_NAN__");
168 Builder.
defineMacro(DefPrefix +
"MANT_DIG__", Twine(MantissaDigits));
170 Builder.
defineMacro(DefPrefix +
"MAX_10_EXP__", Twine(Max10Exp));
171 Builder.
defineMacro(DefPrefix +
"MAX_EXP__", Twine(MaxExp));
172 Builder.
defineMacro(DefPrefix +
"MAX__", Twine(Max)+Ext);
174 Builder.
defineMacro(DefPrefix +
"MIN_10_EXP__",
"("+Twine(Min10Exp)+
")");
175 Builder.
defineMacro(DefPrefix +
"MIN_EXP__",
"("+Twine(MinExp)+
")");
176 Builder.
defineMacro(DefPrefix +
"MIN__", Twine(Min)+Ext);
184 StringRef ValSuffix,
bool isSigned,
186 llvm::APInt MaxVal = isSigned ? llvm::APInt::getSignedMaxValue(TypeWidth)
187 : llvm::APInt::getMaxValue(TypeWidth);
188 Builder.
defineMacro(MacroName, MaxVal.toString(10, isSigned) + ValSuffix);
203 for (
const char *Fmt = IsSigned ?
"di" :
"ouxX"; *Fmt; ++Fmt) {
204 Builder.
defineMacro(Prefix +
"_FMT" + Twine(*Fmt) +
"__",
205 Twine(
"\"") + FmtModifier + Twine(*Fmt) +
"\"");
236 const char *Prefix = IsSigned ?
"__INT" :
"__UINT";
238 DefineType(Prefix + Twine(TypeWidth) +
"_TYPE__", Ty, Builder);
239 DefineFmt(Prefix + Twine(TypeWidth), Ty, TI, Builder);
242 Builder.
defineMacro(Prefix + Twine(TypeWidth) +
"_C_SUFFIX__", ConstSuffix);
256 const char *Prefix = IsSigned ?
"__INT" :
"__UINT";
257 DefineTypeSize(Prefix + Twine(TypeWidth) +
"_MAX__", Ty, TI, Builder);
267 const char *Prefix = IsSigned ?
"__INT_LEAST" :
"__UINT_LEAST";
268 DefineType(Prefix + Twine(TypeWidth) +
"_TYPE__", Ty, Builder);
269 DefineTypeSize(Prefix + Twine(TypeWidth) +
"_MAX__", Ty, TI, Builder);
270 DefineFmt(Prefix + Twine(TypeWidth), Ty, TI, Builder);
281 const char *Prefix = IsSigned ?
"__INT_FAST" :
"__UINT_FAST";
282 DefineType(Prefix + Twine(TypeWidth) +
"_TYPE__", Ty, Builder);
283 DefineTypeSize(Prefix + Twine(TypeWidth) +
"_MAX__", Ty, TI, Builder);
285 DefineFmt(Prefix + Twine(TypeWidth), Ty, TI, Builder);
292 unsigned InlineWidth) {
295 if (TypeWidth == TypeAlign && (TypeWidth & (TypeWidth - 1)) == 0 &&
296 TypeWidth <= InlineWidth)
307 Builder.
defineMacro(
"_GLIBCXX_PREDEFINED_OBJC_ARC_IS_SCALAR");
316 llvm::raw_string_ostream Out(Result);
318 Out <<
"namespace std {\n"
320 <<
"struct __true_type;\n"
321 <<
"struct __false_type;\n"
324 Out <<
"template<typename _Tp> struct __is_scalar;\n"
327 Out <<
"template<typename _Tp>\n"
328 <<
"struct __is_scalar<__attribute__((objc_ownership(strong))) _Tp> {\n"
329 <<
" enum { __value = 0 };\n"
330 <<
" typedef __false_type __type;\n"
334 if (LangOpts.ObjCARCWeak) {
335 Out <<
"template<typename _Tp>\n"
336 <<
"struct __is_scalar<__attribute__((objc_ownership(weak))) _Tp> {\n"
337 <<
" enum { __value = 0 };\n"
338 <<
" typedef __false_type __type;\n"
343 Out <<
"template<typename _Tp>\n"
344 <<
"struct __is_scalar<__attribute__((objc_ownership(autoreleasing)))"
346 <<
" enum { __value = 0 };\n"
347 <<
" typedef __false_type __type;\n"
360 if (!LangOpts.MSVCCompat && !LangOpts.TraditionalCPP)
362 if (LangOpts.Freestanding)
367 if (!LangOpts.CPlusPlus) {
369 Builder.
defineMacro(
"__STDC_VERSION__",
"201112L");
370 else if (LangOpts.C99)
371 Builder.
defineMacro(
"__STDC_VERSION__",
"199901L");
372 else if (!LangOpts.GNUMode && LangOpts.Digraphs)
373 Builder.
defineMacro(
"__STDC_VERSION__",
"199409L");
376 if (LangOpts.CPlusPlus1z)
381 else if (LangOpts.CPlusPlus14)
386 else if (LangOpts.CPlusPlus11)
407 if (LangOpts.AsmPreprocessor)
418 if (LangOpts.CXXExceptions)
422 if (LangOpts.CPlusPlus11) {
423 Builder.
defineMacro(
"__cpp_unicode_characters",
"200704");
424 Builder.
defineMacro(
"__cpp_raw_strings",
"200710");
425 Builder.
defineMacro(
"__cpp_unicode_literals",
"200710");
426 Builder.
defineMacro(
"__cpp_user_defined_literals",
"200809");
429 LangOpts.CPlusPlus14 ?
"201304" :
"200704");
430 Builder.
defineMacro(
"__cpp_range_based_for",
"200907");
431 Builder.
defineMacro(
"__cpp_static_assert",
"200410");
434 Builder.
defineMacro(
"__cpp_rvalue_references",
"200610");
435 Builder.
defineMacro(
"__cpp_variadic_templates",
"200704");
436 Builder.
defineMacro(
"__cpp_initializer_lists",
"200806");
437 Builder.
defineMacro(
"__cpp_delegating_constructors",
"200604");
439 Builder.
defineMacro(
"__cpp_inheriting_constructors",
"200802");
440 Builder.
defineMacro(
"__cpp_ref_qualifiers",
"200710");
441 Builder.
defineMacro(
"__cpp_alias_templates",
"200704");
445 if (LangOpts.CPlusPlus14) {
446 Builder.
defineMacro(
"__cpp_binary_literals",
"201304");
447 Builder.
defineMacro(
"__cpp_digit_separators",
"201309");
448 Builder.
defineMacro(
"__cpp_init_captures",
"201304");
449 Builder.
defineMacro(
"__cpp_generic_lambdas",
"201304");
450 Builder.
defineMacro(
"__cpp_decltype_auto",
"201304");
451 Builder.
defineMacro(
"__cpp_return_type_deduction",
"201304");
452 Builder.
defineMacro(
"__cpp_aggregate_nsdmi",
"201304");
453 Builder.
defineMacro(
"__cpp_variable_templates",
"201304");
455 if (LangOpts.SizedDeallocation)
456 Builder.
defineMacro(
"__cpp_sized_deallocation",
"201309");
457 if (LangOpts.ConceptsTS)
458 Builder.
defineMacro(
"__cpp_experimental_concepts",
"1");
469 #define TOSTR(X) TOSTR2(X)
472 #ifdef CLANG_VERSION_PATCHLEVEL
473 Builder.
defineMacro(
"__clang_patchlevel__",
TOSTR(CLANG_VERSION_PATCHLEVEL));
482 if (!LangOpts.MSVCCompat) {
500 Builder.
defineMacro(
"__PRAGMA_REDEFINE_EXTNAME",
"1");
505 Builder.
defineMacro(
"__VERSION__",
"\"4.2.1 Compatible " +
511 if (!LangOpts.GNUMode && !LangOpts.MSVCCompat)
514 if (!LangOpts.MSVCCompat && LangOpts.CPlusPlus11)
517 if (LangOpts.ObjC1) {
521 if (LangOpts.ObjCExceptions)
536 minor = tuple.
getMinor().getValue();
538 unsigned subminor = 0;
543 Twine(tuple.
getMajor() * 10000 + minor * 100 +
547 Builder.
defineMacro(
"IBOutlet",
"__attribute__((iboutlet))");
548 Builder.
defineMacro(
"IBOutletCollection(ClassName)",
549 "__attribute__((iboutletcollection(ClassName)))");
550 Builder.
defineMacro(
"IBAction",
"void)__attribute__((ibaction)");
555 if (LangOpts.CPlusPlus)
560 if (!LangOpts.NoConstantCFStrings)
566 if (LangOpts.PascalStrings)
569 if (LangOpts.Blocks) {
570 Builder.
defineMacro(
"__block",
"__attribute__((__blocks__(byref)))");
574 if (!LangOpts.MSVCCompat && LangOpts.Exceptions)
576 if (!LangOpts.MSVCCompat && LangOpts.RTTI)
578 if (LangOpts.SjLjExceptions)
581 if (LangOpts.Deprecated)
584 if (!LangOpts.MSVCCompat && LangOpts.CPlusPlus) {
587 Builder.
defineMacro(
"__private_extern__",
"extern");
590 if (LangOpts.MicrosoftExt) {
591 if (LangOpts.WChar) {
598 if (LangOpts.Optimize)
600 if (LangOpts.OptimizeSize)
603 if (LangOpts.FastMath)
613 Builder.
defineMacro(
"__ORDER_LITTLE_ENDIAN__",
"1234");
614 Builder.
defineMacro(
"__ORDER_BIG_ENDIAN__",
"4321");
615 Builder.
defineMacro(
"__ORDER_PDP_ENDIAN__",
"3412");
617 Builder.
defineMacro(
"__BYTE_ORDER__",
"__ORDER_BIG_ENDIAN__");
620 Builder.
defineMacro(
"__BYTE_ORDER__",
"__ORDER_LITTLE_ENDIAN__");
637 assert(TI.
getCharWidth() == 8 &&
"Only support 8-bit char so far");
717 if (!LangOpts.CharIsSigned)
788 Builder.
defineMacro(
"__USER_LABEL_PREFIX__", Prefix);
790 if (LangOpts.FastMath || LangOpts.FiniteMathOnly)
795 if (!LangOpts.MSVCCompat) {
796 if (LangOpts.GNUInline || LangOpts.CPlusPlus)
803 Builder.
defineMacro(
"__GCC_ATOMIC_TEST_AND_SET_TRUEVAL",
"1");
807 #define DEFINE_LOCK_FREE_MACRO(TYPE, Type) \
808 Builder.defineMacro("__GCC_ATOMIC_" #TYPE "_LOCK_FREE", \
809 getLockFreeValue(TI.get##Type##Width(), \
810 TI.get##Type##Align(), \
821 Builder.
defineMacro(
"__GCC_ATOMIC_POINTER_LOCK_FREE",
825 #undef DEFINE_LOCK_FREE_MACRO
828 if (LangOpts.NoInlineDefine)
831 if (
unsigned PICLevel = LangOpts.PICLevel) {
835 if (
unsigned PIELevel = LangOpts.PIELevel) {
843 Builder.
defineMacro(
"__DECIMAL_DIG__",
"__LDBL_DECIMAL_DIG__");
853 Builder.
defineMacro(
"__weak",
"__attribute__((objc_gc(weak)))");
859 if (LangOpts.FastRelaxedMath)
862 if (LangOpts.ObjCAutoRefCount) {
863 Builder.
defineMacro(
"__weak",
"__attribute__((objc_ownership(weak)))");
864 Builder.
defineMacro(
"__strong",
"__attribute__((objc_ownership(strong)))");
866 "__attribute__((objc_ownership(autoreleasing)))");
868 "__attribute__((objc_ownership(none)))");
875 Builder.
defineMacro(
"__null_unspecified",
"_Null_unspecified");
880 if (LangOpts.OpenMP) {
890 if (LangOpts.CUDAIsDevice) {
908 std::string PredefineBuffer;
909 PredefineBuffer.reserve(4080);
910 llvm::raw_string_ostream Predefines(PredefineBuffer);
917 Builder.
append(
"# 1 \"<built-in>\" 3");
925 if (LangOpts.ObjC1 && LangOpts.CPlusPlus && LangOpts.ObjCAutoRefCount) {
947 Builder.
append(
"# 1 \"<command line>\" 1");
950 for (
unsigned i = 0, e = InitOpts.
Macros.size(); i != e; ++i) {
951 if (InitOpts.
Macros[i].second)
960 for (
unsigned i = 0, e = InitOpts.
MacroIncludes.size(); i != e; ++i)
971 for (
unsigned i = 0, e = InitOpts.
Includes.size(); i != e; ++i) {
972 const std::string &Path = InitOpts.
Includes[i];
978 Builder.
append(
"# 1 \"<built-in>\" 2");
std::vector< std::pair< std::string, bool > > Macros
Defines the clang::MacroBuilder utility class.
Represents a version number in the form major[.minor[.subminor[.build]]].
Defines the clang::FileManager interface and associated types.
static LLVM_READONLY bool isWhitespace(unsigned char c)
Defines the SourceManager interface.
static void DefineFmt(const Twine &Prefix, TargetInfo::IntType Ty, const TargetInfo &TI, MacroBuilder &Builder)
IntType getSizeType() const
std::vector< std::string > Includes
Optional< unsigned > getMinor() const
Retrieve the minor version number, if provided.
IntType getWIntType() const
static void AddImplicitIncludeMacros(MacroBuilder &Builder, StringRef File)
StringRef getOriginalSourceFile()
Retrieve the name of the original source file name for the primary module file.
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
std::string ImplicitPTHInclude
static void DefineTypeSizeof(StringRef MacroName, unsigned BitWidth, const TargetInfo &TI, MacroBuilder &Builder)
unsigned getLongDoubleWidth() const
void setPredefines(const char *P)
Set the predefines for this Preprocessor.
unsigned getFloatWidth() const
getFloatWidth/Align/Format - Return the size/align/format of 'float'.
static void AddImplicitIncludePCH(MacroBuilder &Builder, Preprocessor &PP, const PCHContainerReader &PCHContainerRdr, StringRef ImplicitIncludePCH)
Add an implicit #include using the original file used to generate a PCH file.
static void AddObjCXXARCLibstdcxxDefines(const LangOptions &LangOpts, MacroBuilder &Builder)
Add definitions required for a smooth interaction between Objective-C++ automated reference counting ...
unsigned getDoubleWidth() const
getDoubleWidth/Align/Format - Return the size/align/format of 'double'.
const char * getTypeConstantSuffix(IntType T) const
Return the constant suffix for the specified integer type enum.
void undefineMacro(const Twine &Name)
const LangOptions & getLangOpts() const
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
FileManager & getFileManager() const
static bool isTypeSigned(IntType T)
Returns true if the type is signed; false otherwise.
virtual unsigned getFloatEvalMethod() const
Return the value for the C99 FLT_EVAL_METHOD macro.
const llvm::fltSemantics & getDoubleFormat() const
IntType getIntMaxType() const
Concrete class used by the front-end to report problems and issues.
static void InitializePredefinedMacros(const TargetInfo &TI, const LangOptions &LangOpts, const FrontendOptions &FEOpts, MacroBuilder &Builder)
void append(const Twine &Str)
Directly append Str and a newline to the underlying buffer.
static void DefineType(const Twine &MacroName, TargetInfo::IntType Ty, MacroBuilder &Builder)
const char * getOriginalSourceFile() const
static void DefineFloatMacros(MacroBuilder &Builder, StringRef Prefix, const llvm::fltSemantics *Sem, StringRef Ext)
static void AddImplicitInclude(MacroBuilder &Builder, StringRef File)
const TargetInfo & getTargetInfo() const
static void DefineExactWidthIntTypeSize(TargetInfo::IntType Ty, const TargetInfo &TI, MacroBuilder &Builder)
static void DefineExactWidthIntType(TargetInfo::IntType Ty, const TargetInfo &TI, MacroBuilder &Builder)
unsigned UsePredefines
Initialize the preprocessor with the compiler and target specific predefines.
unsigned getTypeWidth(IntType T) const
Return the width (in bits) of the specified integer type enum.
Exposes information about the current target.
static void DefineLeastWidthIntType(unsigned TypeWidth, bool IsSigned, const TargetInfo &TI, MacroBuilder &Builder)
bool isNeXTFamily() const
Is this runtime basically of the NeXT family of runtimes?
const char * getUserLabelPrefix() const
Returns the default value of the USER_LABEL_PREFIX macro, which is the prefix given to user symbols b...
IntType getIntPtrType() const
static void DefineTypeSize(const Twine &MacroName, unsigned TypeWidth, StringRef ValSuffix, bool isSigned, MacroBuilder &Builder)
const llvm::fltSemantics & getFloatFormat() const
Defines version macros and version-related utility functions for Clang.
Defines the clang::Preprocessor interface.
IntType getUInt64Type() const
clang::ObjCRuntime ObjCRuntime
The result type of a method or function.
IntType getChar32Type() const
static const char * getTypeName(IntType T)
Return the user string for the specified integer type enum.
IntType getUIntPtrType() const
static const char * getLockFreeValue(unsigned TypeWidth, unsigned TypeAlign, unsigned InlineWidth)
static bool MacroBodyEndsInBackslash(StringRef MacroBody)
bool isNonFragile() const
Does this runtime follow the set of implied behaviors for a "non-fragile" ABI?
uint64_t getPointerAlign(unsigned AddrSpace) const
static void DefineFastIntType(unsigned TypeWidth, bool IsSigned, const TargetInfo &TI, MacroBuilder &Builder)
static void InitializeStandardPredefinedMacros(const TargetInfo &TI, const LangOptions &LangOpts, const FrontendOptions &FEOpts, MacroBuilder &Builder)
static void DefineBuiltinMacro(MacroBuilder &Builder, StringRef Macro, DiagnosticsEngine &Diags)
static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts, MacroBuilder &Builder)
std::string ImplicitPCHInclude
The implicit PCH included at the start of the translation unit, or empty.
'objfw' is the Objective-C runtime included in ObjFW
IntType getSigAtomicType() const
static void AddImplicitIncludePTH(MacroBuilder &Builder, Preprocessor &PP, StringRef ImplicitIncludePTH)
std::string getClangFullRepositoryVersion()
Retrieves the full repository version that is an amalgamation of the information in getClangRepositor...
unsigned getMajor() const
Retrieve the major version number.
IntType getUIntMaxType() const
const VersionTuple & getVersion() const
DiagnosticsEngine & getDiagnostics() const
std::vector< std::string > MacroIncludes
IntType getWCharType() const
IntType
===-— Target Data Type Query Methods ----------------------------—===//
const llvm::fltSemantics & getLongDoubleFormat() const
static const char * getTypeFormatModifier(IntType T)
Return the printf format modifier for the specified integer type enum.
frontend::ActionKind ProgramAction
The frontend action to perform.
unsigned getCharWidth() const
unsigned getShortWidth() const
Return the size of 'signed short' and 'unsigned short' for this target, in bits.
IntType getLeastIntTypeByWidth(unsigned BitWidth, bool IsSigned) const
Return the smallest integer type with at least the specified width.
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
virtual bool hasInt128Type() const
Determine whether the __int128 type is supported on this target.
unsigned getMaxAtomicInlineWidth() const
Return the maximum width lock-free atomic operation which can be inlined given the supported features...
FrontendOptions - Options for controlling the behavior of the frontend.
#define DEFINE_LOCK_FREE_MACRO(TYPE, Type)
virtual void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const =0
===-— Other target property query methods --------------------——===//
Optional< unsigned > getSubminor() const
Retrieve the subminor version number, if provided.
ObjCXXARCStandardLibraryKind ObjCXXARCStandardLibrary
The Objective-C++ ARC standard library that we should support, by providing appropriate definitions t...
unsigned getIntWidth() const
unsigned getLongLongWidth() const
std::string getClangFullCPPVersion()
Retrieves a string representing the complete clang version suitable for use in the CPP VERSION macro...
uint64_t getPointerWidth(unsigned AddrSpace) const
Return the width of pointers on this target, for the specified address space.
BoundNodesTreeBuilder *const Builder
void InitializePreprocessor(Preprocessor &PP, const PreprocessorOptions &PPOpts, const PCHContainerReader &PCHContainerRdr, const FrontendOptions &FEOpts)
IntType getInt64Type() const
IntType getChar16Type() const
Run one or more source code analyses.
unsigned getLongWidth() const
std::pair< unsigned, bool > PrecompiledPreambleBytes
If non-zero, the implicit PCH include is actually a precompiled preamble that covers this number of b...
Defines the clang::TargetInfo interface.
#define CLANG_VERSION_STRING
A string that describes the Clang version number, e.g., "1.0".
unsigned getSuitableAlign() const
Return the alignment that is suitable for storing any object with a fundamental alignment requirement...
void defineMacro(const Twine &Name, const Twine &Value="1")
Append a #define line for macro of the form "\#define Name Value\n".
void setSkipMainFilePreamble(unsigned Bytes, bool StartOfLine)
Instruct the preprocessor to skip part of the main source file.
static T PickFP(const llvm::fltSemantics *Sem, T IEEESingleVal, T IEEEDoubleVal, T X87DoubleExtendedVal, T PPCDoubleDoubleVal, T IEEEQuadVal)
IntType getPtrDiffType(unsigned AddrSpace) const
PTHManager * getPTHManager()
static void DefineTypeWidth(StringRef MacroName, TargetInfo::IntType Ty, const TargetInfo &TI, MacroBuilder &Builder)
Engages in a tight little dance with the lexer to efficiently preprocess tokens.