15#ifndef LLVM_CLANG_BASIC_BUILTINS_H
16#define LLVM_CLANG_BASIC_BUILTINS_H
18#include "llvm/ADT/ArrayRef.h"
19#include "llvm/ADT/StringMap.h"
20#include "llvm/ADT/StringRef.h"
53#define HEADER(ID, NAME) ID,
54#include "clang/Basic/BuiltinHeaders.def"
66#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
67#include "clang/Basic/Builtins.inc"
107 return getRecord(
ID).
Type;
117 return strchr(getRecord(
ID).Attributes,
'U') !=
nullptr;
123 return strchr(getRecord(
ID).Attributes,
'c') !=
nullptr;
128 return strchr(getRecord(
ID).Attributes,
'n') !=
nullptr;
133 return strchr(getRecord(
ID).Attributes,
'r') !=
nullptr;
138 return strchr(getRecord(
ID).Attributes,
'j') !=
nullptr;
144 return strchr(getRecord(
ID).Attributes,
'u') !=
nullptr;
150 return strchr(getRecord(
ID).Attributes,
'F') !=
nullptr;
161 return strchr(getRecord(
ID).Attributes,
'f') !=
nullptr;
168 return strchr(getRecord(
ID).Attributes,
'h') !=
nullptr;
175 return strchr(getRecord(
ID).Attributes,
'i') !=
nullptr;
183 return strchr(getRecord(
ID).Attributes,
'z') !=
nullptr;
197 return strchr(getRecord(
ID).Attributes,
't') !=
nullptr;
203 return strchr(getRecord(
ID).Attributes,
'T') !=
nullptr ||
210 return strchr(getRecord(
ID).
Type,
'*') !=
nullptr;
216 return strchr(getRecord(
ID).
Type,
'&') !=
nullptr ||
217 strchr(getRecord(
ID).
Type,
'A') !=
nullptr;
229 bool isPrintfLike(
unsigned ID,
unsigned &FormatIdx,
bool &HasVAListArg);
234 bool isScanfLike(
unsigned ID,
unsigned &FormatIdx,
bool &HasVAListArg);
248 return strchr(getRecord(
ID).Attributes,
'e') !=
nullptr;
252 return strchr(getRecord(
ID).Attributes,
'g') !=
nullptr;
280 return strchr(getRecord(
ID).Attributes,
'E') !=
nullptr;
285 return strchr(getRecord(
ID).Attributes,
'G') !=
nullptr;
289 const Info &getRecord(
unsigned ID)
const;
292 bool isLike(
unsigned ID,
unsigned &FormatIdx,
bool &HasVAListArg,
293 const char *Fmt)
const;
301 llvm::StringRef RequiredFatures,
302 const llvm::StringMap<bool> &TargetFetureMap);
llvm::MachO::Target Target
Holds information about both target-independent and target-specific builtins, allowing easy queries b...
bool isUnevaluated(unsigned ID) const
Returns true if this builtin does not perform the side-effects of its arguments.
bool hasReferenceArgsOrResult(unsigned ID) const
Return true if this builtin has a result or any arguments which are reference types.
bool performsCallback(unsigned ID, llvm::SmallVectorImpl< int > &Encoding) const
Determine whether this builtin has callback behavior (see llvm::AbstractCallSites for details).
bool isAuxBuiltinID(unsigned ID) const
Return true if builtin ID belongs to AuxTarget.
bool isLibFunction(unsigned ID) const
Return true if this is a builtin for a libc/libm function, with a "__builtin_" prefix (e....
const char * getHeaderName(unsigned ID) const
If this is a library function that comes from a specific header, retrieve that header name.
bool hasPtrArgsOrResult(unsigned ID) const
Determines whether this builtin has a result or any arguments which are pointer types.
llvm::StringRef getName(unsigned ID) const
Return the identifier name for the specified builtin, e.g.
bool isReturnsTwice(unsigned ID) const
Return true if we know this builtin can return twice.
bool isImmediate(unsigned ID) const
Returns true if this is an immediate (consteval) function.
bool isConstWithoutErrnoAndExceptions(unsigned ID) const
Return true if this function has no side effects and doesn't read memory, except for possibly errno o...
static bool isBuiltinFunc(llvm::StringRef Name)
Returns true if this is a libc/libm function without the '__builtin_' prefix.
const char * getTypeString(unsigned ID) const
Get the type descriptor string for the specified builtin.
unsigned getRequiredVectorWidth(unsigned ID) const
unsigned getAuxBuiltinID(unsigned ID) const
Return real builtin ID (i.e.
bool allowTypeMismatch(unsigned ID) const
Determines whether a declaration of this builtin should be recognized even if the type doesn't match ...
bool isTSBuiltin(unsigned ID) const
Return true if this function is a target-specific builtin.
bool hasCustomTypechecking(unsigned ID) const
Determines whether this builtin has custom typechecking.
bool isHeaderDependentFunction(unsigned ID) const
Returns true if this builtin requires appropriate header in other compilers.
void initializeBuiltins(IdentifierTable &Table, const LangOptions &LangOpts)
Mark the identifiers for all the builtins with their appropriate builtin ID # and mark any non-portab...
bool isScanfLike(unsigned ID, unsigned &FormatIdx, bool &HasVAListArg)
Determine whether this builtin is like scanf in its formatting rules and, if so, set the index to the...
bool isInStdNamespace(unsigned ID) const
Determines whether this builtin is a C++ standard library function that lives in (possibly-versioned)...
bool canBeRedeclared(unsigned ID) const
Returns true if this is a builtin that can be redeclared.
const char * getRequiredFeatures(unsigned ID) const
bool isConstantEvaluated(unsigned ID) const
Return true if this function can be constant evaluated by Clang frontend.
bool isPredefinedLibFunction(unsigned ID) const
Determines whether this builtin is a predefined libc/libm function, such as "malloc",...
bool isPrintfLike(unsigned ID, unsigned &FormatIdx, bool &HasVAListArg)
Determine whether this builtin is like printf in its formatting rules and, if so, set the index to th...
bool isNoReturn(unsigned ID) const
Return true if we know this builtin never returns.
bool isDirectlyAddressable(unsigned ID) const
Determines whether this builtin can have its address taken with no special action required.
bool isConstWithoutExceptions(unsigned ID) const
bool isPredefinedRuntimeFunction(unsigned ID) const
Determines whether this builtin is a predefined compiler-rt/libgcc function, such as "__clear_cache",...
bool isPure(unsigned ID) const
Return true if this function has no side effects.
bool isNoThrow(unsigned ID) const
Return true if we know this builtin never throws an exception.
void InitializeTarget(const TargetInfo &Target, const TargetInfo *AuxTarget)
Perform target-specific initialization.
bool isConst(unsigned ID) const
Return true if this function has no side effects and doesn't read memory.
Implements an efficient mapping from strings to IdentifierInfo nodes.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Exposes information about the current target.
The base class of the type hierarchy.
bool evaluateRequiredTargetFeatures(llvm::StringRef RequiredFatures, const llvm::StringMap< bool > &TargetFetureMap)
Returns true if the required target features of a builtin function are enabled.
The JSON file list parser is used to communicate input to InstallAPI.
BuiltinTemplateKind
Kinds of BuiltinTemplateDecl.
@ BTK__type_pack_element
This names the __type_pack_element BuiltinTemplateDecl.
@ BTK__make_integer_seq
This names the __make_integer_seq BuiltinTemplateDecl.