clang 20.0.0git
|
#include "clang/Basic/FileManager.h"
#include "clang/Basic/HLSLRuntime.h"
#include "clang/Basic/MacroBuilder.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/SyncScope.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Basic/Version.h"
#include "clang/Frontend/FrontendDiagnostic.h"
#include "clang/Frontend/FrontendOptions.h"
#include "clang/Frontend/Utils.h"
#include "clang/Lex/HeaderSearch.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Lex/PreprocessorOptions.h"
#include "clang/Serialization/ASTReader.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "clang/Basic/OpenCLExtensions.def"
#include "clang/Basic/TargetOSMacros.def"
Go to the source code of this file.
Macros | |
#define | OPENCL_GENERIC_EXTENSION(Ext, ...) defineOpenCLExtMacro(#Ext, __VA_ARGS__); |
#define | TOSTR2(X) #X |
#define | TOSTR(X) TOSTR2(X) |
#define | DEFINE_LOCK_FREE_MACRO(TYPE, Type) |
#define | TARGET_OS(Name, Predicate) Builder.defineMacro(#Name, (Predicate) ? "1" : "0"); |
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. | |
static void | AddImplicitIncludeMacros (MacroBuilder &Builder, StringRef File) |
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. | |
template<typename T > | |
static T | PickFP (const llvm::fltSemantics *Sem, T IEEEHalfVal, 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. | |
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. | |
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. | |
static void | DefineFmt (const LangOptions &LangOpts, 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 (const Twine &MacroName, TargetInfo::IntType Ty, const TargetInfo &TI, MacroBuilder &Builder) |
static void | DefineTypeSizeof (StringRef MacroName, unsigned BitWidth, const TargetInfo &TI, MacroBuilder &Builder) |
static void | DefineTypeSizeAndWidth (const Twine &Prefix, TargetInfo::IntType Ty, const TargetInfo &TI, MacroBuilder &Builder) |
static void | DefineExactWidthIntType (const LangOptions &LangOpts, TargetInfo::IntType Ty, const TargetInfo &TI, MacroBuilder &Builder) |
static void | DefineExactWidthIntTypeSize (TargetInfo::IntType Ty, const TargetInfo &TI, MacroBuilder &Builder) |
static void | DefineLeastWidthIntType (const LangOptions &LangOpts, unsigned TypeWidth, bool IsSigned, const TargetInfo &TI, MacroBuilder &Builder) |
static void | DefineFastIntType (const LangOptions &LangOpts, unsigned TypeWidth, bool IsSigned, const TargetInfo &TI, MacroBuilder &Builder) |
static const char * | getLockFreeValue (unsigned TypeWidth, const TargetInfo &TI) |
Get the value the ATOMIC_*_LOCK_FREE macro should have for a type with the specified properties. | |
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). | |
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". | |
void | InitializeOpenCLFeatureTestMacros (const TargetInfo &TI, const LangOptions &Opts, MacroBuilder &Builder) |
InitializeOpenCLFeatureTestMacros - Define OpenCL macros based on target settings and language version. | |
llvm::SmallString< 32 > | ConstructFixedPointLiteral (llvm::APFixedPoint Val, llvm::StringRef Suffix) |
void | DefineFixedPointMacros (const TargetInfo &TI, MacroBuilder &Builder, llvm::StringRef TypeName, llvm::StringRef Suffix, unsigned Width, unsigned Scale, bool Signed) |
static void | InitializePredefinedMacros (const TargetInfo &TI, const LangOptions &LangOpts, const FrontendOptions &FEOpts, const PreprocessorOptions &PPOpts, MacroBuilder &Builder) |
static void | InitializePGOProfileMacros (const CodeGenOptions &CodeGenOpts, MacroBuilder &Builder) |
#define OPENCL_GENERIC_EXTENSION | ( | Ext, | |
... | |||
) | defineOpenCLExtMacro(#Ext, __VA_ARGS__); |
#define TARGET_OS | ( | Name, | |
Predicate | |||
) | Builder.defineMacro(#Name, (Predicate) ? "1" : "0"); |
|
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 70 of file InitPreprocessor.cpp.
References clang::File.
Referenced by AddImplicitIncludePCH(), and clang::InitializePreprocessor().
|
static |
Definition at line 74 of file InitPreprocessor.cpp.
References clang::File.
Referenced by clang::InitializePreprocessor().
|
static |
Add an implicit #include using the original file used to generate a PCH file.
Definition at line 82 of file InitPreprocessor.cpp.
References AddImplicitInclude(), clang::Preprocessor::getDiagnostics(), clang::Preprocessor::getFileManager(), and clang::ASTReader::getOriginalSourceFile().
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 331 of file InitPreprocessor.cpp.
Referenced by clang::InitializePreprocessor().
llvm::SmallString< 32 > ConstructFixedPointLiteral | ( | llvm::APFixedPoint | Val, |
llvm::StringRef | Suffix | ||
) |
Definition at line 798 of file InitPreprocessor.cpp.
References ConstructFixedPointLiteral().
Referenced by ConstructFixedPointLiteral(), and DefineFixedPointMacros().
|
static |
Definition at line 41 of file InitPreprocessor.cpp.
References MacroBodyEndsInBackslash(), and clang::DiagnosticsEngine::Report().
Referenced by clang::InitializePreprocessor().
|
static |
Definition at line 232 of file InitPreprocessor.cpp.
References DefineFmt(), DefineType(), clang::TargetInfo::getInt16Type(), clang::TargetInfo::getInt64Type(), clang::TargetInfo::getTypeConstantSuffix(), clang::TargetInfo::getTypeWidth(), clang::TargetInfo::getUInt16Type(), clang::TargetInfo::getUInt64Type(), and clang::TargetInfo::isTypeSigned().
Referenced by InitializePredefinedMacros().
|
static |
Definition at line 258 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 294 of file InitPreprocessor.cpp.
References DefineFmt(), DefineType(), DefineTypeSize(), DefineTypeSizeAndWidth(), and clang::TargetInfo::getLeastIntTypeByWidth().
Referenced by InitializePredefinedMacros().
void DefineFixedPointMacros | ( | const TargetInfo & | TI, |
MacroBuilder & | Builder, | ||
llvm::StringRef | TypeName, | ||
llvm::StringRef | Suffix, | ||
unsigned | Width, | ||
unsigned | Scale, | ||
bool | Signed | ||
) |
Definition at line 826 of file InitPreprocessor.cpp.
References ConstructFixedPointLiteral(), clang::TargetInfo::doUnsignedFixedPointTypesHavePadding(), clang::Signed, and clang::TypeName.
Referenced by InitializePredefinedMacros().
|
static |
Definition at line 114 of file InitPreprocessor.cpp.
References clang::Max, clang::Min, and PickFP().
Referenced by InitializePredefinedMacros().
|
static |
Definition at line 189 of file InitPreprocessor.cpp.
References clang::TargetInfo::getTypeFormatModifier(), and clang::TargetInfo::isTypeSigned().
Referenced by DefineExactWidthIntType(), DefineFastIntType(), DefineLeastWidthIntType(), and InitializePredefinedMacros().
|
static |
Definition at line 275 of file InitPreprocessor.cpp.
References DefineFmt(), DefineType(), DefineTypeSize(), DefineTypeSizeAndWidth(), and clang::TargetInfo::getLeastIntTypeByWidth().
Referenced by InitializePredefinedMacros().
|
static |
Definition at line 206 of file InitPreprocessor.cpp.
References clang::TargetInfo::getTypeName().
Referenced by DefineExactWidthIntType(), DefineFastIntType(), DefineLeastWidthIntType(), and InitializePredefinedMacros().
|
static |
DefineTypeSize - An overloaded helper that uses TargetInfo to determine the width, suffix, and signedness of the given type.
Definition at line 183 of file InitPreprocessor.cpp.
References DefineTypeSize(), clang::TargetInfo::getTypeConstantSuffix(), clang::TargetInfo::getTypeWidth(), and clang::TargetInfo::isTypeSigned().
|
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 173 of file InitPreprocessor.cpp.
References toString().
Referenced by DefineExactWidthIntTypeSize(), DefineFastIntType(), DefineLeastWidthIntType(), DefineTypeSize(), DefineTypeSizeAndWidth(), and InitializePredefinedMacros().
|
static |
Definition at line 225 of file InitPreprocessor.cpp.
References DefineTypeSize(), and DefineTypeWidth().
Referenced by DefineFastIntType(), DefineLeastWidthIntType(), and InitializePredefinedMacros().
|
static |
Definition at line 216 of file InitPreprocessor.cpp.
References clang::TargetInfo::getCharWidth().
Referenced by InitializePredefinedMacros().
|
static |
Definition at line 211 of file InitPreprocessor.cpp.
References clang::TargetInfo::getTypeWidth().
Referenced by DefineTypeSizeAndWidth().
|
static |
Get the value the ATOMIC_*_LOCK_FREE macro should have for a type with the specified properties.
Definition at line 317 of file InitPreprocessor.cpp.
References clang::TargetInfo::hasBuiltinAtomic().
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 648 of file InitPreprocessor.cpp.
Referenced by InitializePredefinedMacros().
void InitializeOpenCLFeatureTestMacros | ( | const TargetInfo & | TI, |
const LangOptions & | Opts, | ||
MacroBuilder & | Builder | ||
) |
InitializeOpenCLFeatureTestMacros - Define OpenCL macros based on target settings and language version.
Definition at line 777 of file InitPreprocessor.cpp.
References clang::TargetInfo::getSupportedOpenCLOpts(), clang::TargetInfo::hasFeatureEnabled(), and clang::OpenCLOptions::isOpenCLOptionAvailableIn().
Referenced by InitializePredefinedMacros().
|
static |
Definition at line 1516 of file InitPreprocessor.cpp.
References clang::CodeGenOptions::hasProfileClangUse(), clang::CodeGenOptions::hasProfileInstr(), and clang::CodeGenOptions::hasProfileIRUse().
Referenced by clang::InitializePreprocessor().
|
static |
Definition at line 852 of file InitPreprocessor.cpp.
References clang::AtomicScopeOpenCLModel::AllSVMDevices, Bool, DEFINE_LOCK_FREE_MACRO, DefineExactWidthIntType(), DefineExactWidthIntTypeSize(), DefineFastIntType(), DefineFixedPointMacros(), DefineFloatMacros(), DefineFmt(), DefineLeastWidthIntType(), clang::PreprocessorOptions::DefineTargetOSMacros, DefineType(), DefineTypeSize(), DefineTypeSizeAndWidth(), DefineTypeSizeof(), clang::AtomicScopeOpenCLModel::Device, clang::TargetInfo::getAccumIBits(), clang::TargetInfo::getAccumScale(), clang::TargetInfo::getAccumWidth(), clang::TargetInfo::getBoolWidth(), clang::TargetInfo::getChar16Type(), clang::TargetInfo::getChar32Type(), clang::TargetInfo::getCharWidth(), clang::getClangFullCPPVersion(), clang::getClangFullRepositoryVersion(), clang::TargetInfo::getDoubleFormat(), clang::TargetInfo::getDoubleWidth(), clang::TargetInfo::getFloatFormat(), clang::TargetInfo::getFloatWidth(), clang::TargetInfo::getFractScale(), clang::TargetInfo::getFractWidth(), clang::TargetInfo::getHalfFormat(), clang::TargetInfo::getIntMaxType(), clang::TargetInfo::getIntPtrType(), clang::TargetInfo::getIntWidth(), clang::ObjCRuntime::getKind(), getLockFreeValue(), clang::TargetInfo::getLongAccumIBits(), clang::TargetInfo::getLongAccumScale(), clang::TargetInfo::getLongAccumWidth(), clang::TargetInfo::getLongDoubleFormat(), clang::TargetInfo::getLongDoubleWidth(), clang::TargetInfo::getLongFractScale(), clang::TargetInfo::getLongFractWidth(), clang::TargetInfo::getLongLongWidth(), clang::TargetInfo::getLongWidth(), clang::TargetInfo::getMaxBitIntWidth(), clang::TargetInfo::getPointerWidth(), clang::TargetInfo::getPtrDiffType(), clang::TargetInfo::getShortAccumIBits(), clang::TargetInfo::getShortAccumScale(), clang::TargetInfo::getShortAccumWidth(), clang::TargetInfo::getShortFractScale(), clang::TargetInfo::getShortFractWidth(), clang::TargetInfo::getShortWidth(), clang::TargetInfo::getSigAtomicType(), clang::TargetInfo::getSizeType(), clang::TargetInfo::getSuitableAlign(), clang::TargetInfo::getTargetDefines(), clang::TargetInfo::getTriple(), clang::TargetInfo::getTypeConstantSuffix(), clang::TargetInfo::getTypeWidth(), clang::TargetInfo::getUIntMaxType(), clang::TargetInfo::getUIntPtrType(), clang::TargetInfo::getUnsignedAccumIBits(), clang::TargetInfo::getUnsignedAccumScale(), clang::TargetInfo::getUnsignedFractScale(), clang::TargetInfo::getUnsignedLongAccumIBits(), clang::TargetInfo::getUnsignedLongAccumScale(), clang::TargetInfo::getUnsignedLongFractScale(), clang::TargetInfo::getUnsignedShortAccumIBits(), clang::TargetInfo::getUnsignedShortAccumScale(), clang::TargetInfo::getUnsignedShortFractScale(), clang::TargetInfo::getUserLabelPrefix(), clang::ObjCRuntime::getVersion(), clang::TargetInfo::getWCharType(), clang::TargetInfo::getWIntType(), clang::ObjCRuntime::GNUstep, clang::TargetInfo::hardwareInterferenceSizes(), clang::LangOptions::hasDWARFExceptions(), clang::TargetInfo::hasFloat16Type(), clang::TargetInfo::hasInt128Type(), clang::LangOptions::hasSEHExceptions(), clang::LangOptions::hasSjLjExceptions(), clang::LangOptions::hasWasmExceptions(), InitializeCPlusPlusFeatureTestMacros(), InitializeOpenCLFeatureTestMacros(), clang::TargetInfo::isBigEndian(), clang::ObjCRuntime::isNeXTFamily(), clang::ObjCRuntime::isNonFragile(), clang::TargetInfo::isTypeSigned(), clang::Long, clang::LongLong, clang::LangOptions::ObjCRuntime, clang::ObjCRuntime::ObjFW, clang::FrontendOptions::ProgramAction, clang::frontend::RewriteObjC, clang::PreprocessorOptions::SetUpStaticAnalyzer, clang::Short, clang::AtomicScopeOpenCLModel::SubGroup, TOSTR, clang::TransferrableTargetInfo::UnsignedChar, clang::TargetInfo::useSignedCharForObjCBool(), and clang::AtomicScopeOpenCLModel::WorkGroup.
Referenced by clang::InitializePreprocessor().
|
static |
Definition at line 386 of file InitPreprocessor.cpp.
References clang::TargetInfo::getCharWidth(), clang::TargetInfo::getNewAlign(), clang::TargetInfo::getSizeType(), clang::TargetInfo::getTriple(), clang::TargetInfo::getTypeConstantSuffix(), clang::LangOptions::GPUDefaultStream, clang::TargetInfo::hasHIPImageSupport(), clang::TargetInfo::isLittleEndian(), and clang::LangOptions::OpenACCMacroOverride.
Referenced by clang::InitializePreprocessor().
|
static |
Definition at line 32 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 97 of file InitPreprocessor.cpp.
Referenced by DefineFloatMacros().