clang
3.9.0
|
#include "clang/Frontend/Utils.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/MacroBuilder.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Basic/Version.h"
#include "clang/Frontend/FrontendDiagnostic.h"
#include "clang/Frontend/FrontendOptions.h"
#include "clang/Lex/HeaderSearch.h"
#include "clang/Lex/PTHManager.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Lex/PreprocessorOptions.h"
#include "clang/Serialization/ASTReader.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
#include "clang/Basic/OpenCLExtensions.def"
Go to the source code of this file.
Macros | |
#define | TOSTR2(X) #X |
#define | TOSTR(X) TOSTR2(X) |
#define | DEFINE_LOCK_FREE_MACRO(TYPE, Type) |
#define | OPENCLEXT(Ext) |
Functions | |
static bool | MacroBodyEndsInBackslash (StringRef MacroBody) |
static void | DefineBuiltinMacro (MacroBuilder &Builder, StringRef Macro, DiagnosticsEngine &Diags) |
static void | AddImplicitInclude (MacroBuilder &Builder, StringRef File) |
AddImplicitInclude - Add an implicit #include of the specified file to the predefines buffer. More... | |
static void | AddImplicitIncludeMacros (MacroBuilder &Builder, StringRef File) |
static void | AddImplicitIncludePTH (MacroBuilder &Builder, Preprocessor &PP, StringRef ImplicitIncludePTH) |
AddImplicitIncludePTH - Add an implicit #include using the original file used to generate a PTH cache. More... | |
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. More... | |
template<typename T > | |
static T | PickFP (const llvm::fltSemantics *Sem, T IEEESingleVal, T IEEEDoubleVal, T X87DoubleExtendedVal, T PPCDoubleDoubleVal, T IEEEQuadVal) |
PickFP - This is used to pick a value based on the FP semantics of the specified FP model. More... | |
static void | DefineFloatMacros (MacroBuilder &Builder, StringRef Prefix, const llvm::fltSemantics *Sem, StringRef Ext) |
static void | DefineTypeSize (const Twine &MacroName, unsigned TypeWidth, StringRef ValSuffix, bool isSigned, MacroBuilder &Builder) |
DefineTypeSize - Emit a macro to the predefines buffer that declares a macro named MacroName with the max value for a type with width 'TypeWidth' a signedness of 'isSigned' and with a value suffix of 'ValSuffix' (e.g. More... | |
static void | DefineTypeSize (const Twine &MacroName, TargetInfo::IntType Ty, const TargetInfo &TI, MacroBuilder &Builder) |
DefineTypeSize - An overloaded helper that uses TargetInfo to determine the width, suffix, and signedness of the given type. More... | |
static void | DefineFmt (const Twine &Prefix, TargetInfo::IntType Ty, const TargetInfo &TI, MacroBuilder &Builder) |
static void | DefineType (const Twine &MacroName, TargetInfo::IntType Ty, MacroBuilder &Builder) |
static void | DefineTypeWidth (StringRef MacroName, TargetInfo::IntType Ty, const TargetInfo &TI, MacroBuilder &Builder) |
static void | DefineTypeSizeof (StringRef MacroName, unsigned BitWidth, const TargetInfo &TI, MacroBuilder &Builder) |
static void | DefineExactWidthIntType (TargetInfo::IntType Ty, const TargetInfo &TI, MacroBuilder &Builder) |
static void | DefineExactWidthIntTypeSize (TargetInfo::IntType Ty, const TargetInfo &TI, MacroBuilder &Builder) |
static void | DefineLeastWidthIntType (unsigned TypeWidth, bool IsSigned, const TargetInfo &TI, MacroBuilder &Builder) |
static void | DefineFastIntType (unsigned TypeWidth, bool IsSigned, const TargetInfo &TI, MacroBuilder &Builder) |
static const char * | getLockFreeValue (unsigned TypeWidth, unsigned TypeAlign, unsigned InlineWidth) |
Get the value the ATOMIC_*_LOCK_FREE macro should have for a type with the specified properties. More... | |
static void | AddObjCXXARCLibstdcxxDefines (const LangOptions &LangOpts, MacroBuilder &Builder) |
Add definitions required for a smooth interaction between Objective-C++ automated reference counting and libstdc++ (4.2). More... | |
static void | InitializeStandardPredefinedMacros (const TargetInfo &TI, const LangOptions &LangOpts, const FrontendOptions &FEOpts, MacroBuilder &Builder) |
static void | InitializeCPlusPlusFeatureTestMacros (const LangOptions &LangOpts, MacroBuilder &Builder) |
Initialize the predefined C++ language feature test macros defined in ISO/IEC JTC1/SC22/WG21 (C++) SD-6: "SG10 Feature Test Recommendations". More... | |
static void | InitializePredefinedMacros (const TargetInfo &TI, const LangOptions &LangOpts, const FrontendOptions &FEOpts, MacroBuilder &Builder) |
#define DEFINE_LOCK_FREE_MACRO | ( | TYPE, | |
Type | |||
) |
Referenced by InitializePredefinedMacros().
#define OPENCLEXT | ( | Ext | ) |
Referenced by InitializePredefinedMacros().
|
static |
AddImplicitInclude - Add an implicit #include of the specified file to the predefines buffer.
As these includes are generated by -include arguments the header search logic is going to search relatively to the current working directory.
Definition at line 71 of file InitPreprocessor.cpp.
References clang::MacroBuilder::append().
Referenced by AddImplicitIncludePCH(), AddImplicitIncludePTH(), and clang::InitializePreprocessor().
|
static |
Definition at line 75 of file InitPreprocessor.cpp.
References clang::MacroBuilder::append().
Referenced by clang::InitializePreprocessor().
|
static |
Add an implicit #include using the original file used to generate a PCH file.
Definition at line 100 of file InitPreprocessor.cpp.
References AddImplicitInclude(), clang::Preprocessor::getDiagnostics(), clang::Preprocessor::getFileManager(), and clang::ASTReader::getOriginalSourceFile().
Referenced by clang::InitializePreprocessor().
|
static |
AddImplicitIncludePTH - Add an implicit #include using the original file used to generate a PTH cache.
Definition at line 83 of file InitPreprocessor.cpp.
References AddImplicitInclude(), clang::Preprocessor::getDiagnostics(), clang::PTHManager::getOriginalSourceFile(), clang::Preprocessor::getPTHManager(), P, and clang::DiagnosticsEngine::Report().
Referenced by clang::InitializePreprocessor().
|
static |
Add definitions required for a smooth interaction between Objective-C++ automated reference counting and libstdc++ (4.2).
Definition at line 306 of file InitPreprocessor.cpp.
References clang::MacroBuilder::append(), clang::MacroBuilder::defineMacro(), and clang::Result.
Referenced by clang::InitializePreprocessor().
|
static |
Definition at line 42 of file InitPreprocessor.cpp.
References clang::MacroBuilder::defineMacro(), End, MacroBodyEndsInBackslash(), and clang::DiagnosticsEngine::Report().
Referenced by clang::InitializePreprocessor().
|
static |
Definition at line 226 of file InitPreprocessor.cpp.
References DefineFmt(), clang::MacroBuilder::defineMacro(), DefineType(), clang::TargetInfo::getInt64Type(), clang::TargetInfo::getTypeConstantSuffix(), clang::TargetInfo::getTypeWidth(), clang::TargetInfo::getUInt64Type(), and clang::TargetInfo::isTypeSigned().
Referenced by InitializePredefinedMacros().
|
static |
Definition at line 246 of file InitPreprocessor.cpp.
References DefineTypeSize(), clang::TargetInfo::getInt64Type(), clang::TargetInfo::getTypeWidth(), clang::TargetInfo::getUInt64Type(), and clang::TargetInfo::isTypeSigned().
Referenced by InitializePredefinedMacros().
|
static |
Definition at line 274 of file InitPreprocessor.cpp.
References DefineFmt(), DefineType(), DefineTypeSize(), clang::TargetInfo::getLeastIntTypeByWidth(), and clang::TargetInfo::NoInt.
Referenced by InitializePredefinedMacros().
|
static |
Definition at line 130 of file InitPreprocessor.cpp.
References clang::MacroBuilder::defineMacro(), and PickFP().
Referenced by InitializePredefinedMacros().
|
static |
Definition at line 200 of file InitPreprocessor.cpp.
References clang::MacroBuilder::defineMacro(), clang::TargetInfo::getTypeFormatModifier(), and clang::TargetInfo::isTypeSigned().
Referenced by DefineExactWidthIntType(), DefineFastIntType(), DefineLeastWidthIntType(), and InitializePredefinedMacros().
|
static |
Definition at line 261 of file InitPreprocessor.cpp.
References DefineFmt(), DefineType(), DefineTypeSize(), clang::TargetInfo::getLeastIntTypeByWidth(), and clang::TargetInfo::NoInt.
Referenced by InitializePredefinedMacros().
|
static |
Definition at line 210 of file InitPreprocessor.cpp.
References clang::MacroBuilder::defineMacro(), and clang::TargetInfo::getTypeName().
Referenced by DefineExactWidthIntType(), DefineFastIntType(), DefineLeastWidthIntType(), and InitializePredefinedMacros().
|
static |
DefineTypeSize - Emit a macro to the predefines buffer that declares a macro named MacroName with the max value for a type with width 'TypeWidth' a signedness of 'isSigned' and with a value suffix of 'ValSuffix' (e.g.
LL).
Definition at line 184 of file InitPreprocessor.cpp.
References clang::MacroBuilder::defineMacro().
Referenced by DefineExactWidthIntTypeSize(), DefineFastIntType(), DefineLeastWidthIntType(), DefineTypeSize(), and InitializePredefinedMacros().
|
static |
DefineTypeSize - An overloaded helper that uses TargetInfo to determine the width, suffix, and signedness of the given type.
Definition at line 194 of file InitPreprocessor.cpp.
References Builder, DefineTypeSize(), clang::TargetInfo::getTypeConstantSuffix(), clang::TargetInfo::getTypeWidth(), and clang::TargetInfo::isTypeSigned().
|
static |
Definition at line 220 of file InitPreprocessor.cpp.
References clang::MacroBuilder::defineMacro(), and clang::TargetInfo::getCharWidth().
Referenced by InitializePredefinedMacros().
|
static |
Definition at line 215 of file InitPreprocessor.cpp.
References clang::MacroBuilder::defineMacro(), and clang::TargetInfo::getTypeWidth().
Referenced by InitializePredefinedMacros().
|
static |
Get the value the ATOMIC_*_LOCK_FREE macro should have for a type with the specified properties.
Definition at line 292 of file InitPreprocessor.cpp.
Referenced by InitializePredefinedMacros().
|
static |
Initialize the predefined C++ language feature test macros defined in ISO/IEC JTC1/SC22/WG21 (C++) SD-6: "SG10 Feature Test Recommendations".
Definition at line 453 of file InitPreprocessor.cpp.
References clang::MacroBuilder::defineMacro().
Referenced by InitializePredefinedMacros().
|
static |
Definition at line 503 of file InitPreprocessor.cpp.
References Builder, CLANG_VERSION_STRING, DEFINE_LOCK_FREE_MACRO, DefineExactWidthIntType(), DefineExactWidthIntTypeSize(), DefineFastIntType(), DefineFloatMacros(), DefineFmt(), DefineLeastWidthIntType(), clang::MacroBuilder::defineMacro(), DefineType(), DefineTypeSize(), DefineTypeSizeof(), DefineTypeWidth(), clang::TargetInfo::getChar16Type(), clang::TargetInfo::getChar32Type(), clang::TargetInfo::getCharWidth(), clang::getClangFullCPPVersion(), clang::getClangFullRepositoryVersion(), clang::TargetInfo::getDataLayout(), clang::TargetInfo::getDoubleFormat(), clang::TargetInfo::getDoubleWidth(), clang::TargetInfo::getFloatEvalMethod(), clang::TargetInfo::getFloatFormat(), clang::TargetInfo::getFloatWidth(), clang::TargetInfo::getIntMaxType(), clang::TargetInfo::getIntPtrType(), clang::TargetInfo::getIntWidth(), clang::ObjCRuntime::getKind(), getLockFreeValue(), clang::TargetInfo::getLongDoubleFormat(), clang::TargetInfo::getLongDoubleWidth(), clang::TargetInfo::getLongLongWidth(), clang::TargetInfo::getLongWidth(), clang::VersionTuple::getMajor(), clang::TargetInfo::getMaxAtomicInlineWidth(), clang::VersionTuple::getMinor(), clang::TargetInfo::getPointerAlign(), clang::TargetInfo::getPointerWidth(), clang::TargetInfo::getPtrDiffType(), clang::TargetInfo::getShortWidth(), clang::TargetInfo::getSigAtomicType(), clang::TargetInfo::getSizeType(), clang::VersionTuple::getSubminor(), clang::TargetInfo::getSuitableAlign(), clang::TargetInfo::getTargetDefines(), clang::TargetInfo::getTriple(), clang::TargetInfo::getTypeConstantSuffix(), clang::TargetInfo::getTypeWidth(), clang::TargetInfo::getUIntMaxType(), clang::TargetInfo::getUIntPtrType(), clang::ObjCRuntime::getVersion(), clang::TargetInfo::getWCharType(), clang::TargetInfo::getWIntType(), clang::TargetInfo::hasInt128Type(), InitializeCPlusPlusFeatureTestMacros(), clang::TargetInfo::isBigEndian(), clang::ObjCRuntime::isNeXTFamily(), clang::ObjCRuntime::isNonFragile(), clang::TargetInfo::isTypeSigned(), clang::LangOptions::NonGC, clang::LangOptions::ObjCRuntime, clang::ObjCRuntime::ObjFW, clang::FrontendOptions::ProgramAction, clang::frontend::RewriteObjC, clang::frontend::RunAnalysis, clang::TargetInfo::SignedChar, clang::TargetInfo::SignedInt, clang::TargetInfo::SignedLong, clang::TargetInfo::SignedLongLong, clang::TargetInfo::SignedShort, clang::LangOptions::SSPOn, clang::LangOptions::SSPReq, clang::LangOptions::SSPStrong, TOSTR, clang::TargetInfo::UnsignedChar, clang::TargetInfo::UnsignedInt, clang::TargetInfo::UnsignedLong, clang::TargetInfo::UnsignedLongLong, and clang::TargetInfo::UnsignedShort.
Referenced by clang::InitializePreprocessor().
|
static |
Definition at line 361 of file InitPreprocessor.cpp.
References clang::MacroBuilder::defineMacro().
Referenced by clang::InitializePreprocessor().
|
static |
Definition at line 33 of file InitPreprocessor.cpp.
References clang::isWhitespace().
Referenced by DefineBuiltinMacro().
|
static |
PickFP - This is used to pick a value based on the FP semantics of the specified FP model.
Definition at line 115 of file InitPreprocessor.cpp.
Referenced by DefineFloatMacros().