16 #ifndef LLVM_CLANG_BASIC_BUILTINS_H
17 #define LLVM_CLANG_BASIC_BUILTINS_H
19 #include "llvm/ADT/ArrayRef.h"
28 class IdentifierTable;
48 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
49 #include "clang/Basic/Builtins.def"
84 return getRecord(ID).
Name;
89 return getRecord(ID).
Type;
99 return strchr(getRecord(ID).Attributes,
'U') !=
nullptr;
105 return strchr(getRecord(ID).Attributes,
'c') !=
nullptr;
110 return strchr(getRecord(ID).Attributes,
'n') !=
nullptr;
115 return strchr(getRecord(ID).Attributes,
'r') !=
nullptr;
120 return strchr(getRecord(ID).Attributes,
'j') !=
nullptr;
126 return strchr(getRecord(ID).Attributes,
'u') !=
nullptr;
132 return strchr(getRecord(ID).Attributes,
'F') !=
nullptr;
139 return strchr(getRecord(ID).Attributes,
'f') !=
nullptr;
146 return strchr(getRecord(ID).Attributes,
'i') !=
nullptr;
151 return strchr(getRecord(ID).Attributes,
't') !=
nullptr;
157 return strchr(getRecord(ID).
Type,
'*') !=
nullptr;
173 bool isPrintfLike(
unsigned ID,
unsigned &FormatIdx,
bool &HasVAListArg);
178 bool isScanfLike(
unsigned ID,
unsigned &FormatIdx,
bool &HasVAListArg);
185 return strchr(getRecord(ID).Attributes,
'e') !=
nullptr;
206 const Info &getRecord(
unsigned ID)
const;
213 bool isLike(
unsigned ID,
unsigned &FormatIdx,
bool &HasVAListArg,
214 const char *Fmt)
const;
Holds information about both target-independent and target-specific builtins, allowing easy queries b...
bool isNoReturn(unsigned ID) const
Return true if we know this builtin never returns.
static const Builtin::Info BuiltinInfo[]
static bool isBuiltinFunc(const char *Name)
Returns true if this is a libc/libm function without the '__builtin_' prefix.
void forgetBuiltin(unsigned ID, IdentifierTable &Table)
Completely forget that the given ID was ever considered a builtin, e.g., because the user provided a ...
bool isPredefinedLibFunction(unsigned ID) const
Determines whether this builtin is a predefined libc/libm function, such as "malloc", where we know the signature a priori.
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...
The base class of the type hierarchy.
bool isAuxBuiltinID(unsigned ID) const
Return true if builtin ID belongs to AuxTarget.
bool hasPtrArgsOrResult(unsigned ID) const
Determines whether this builtin has a result or any arguments which are pointer types.
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
bool isUnevaluated(unsigned ID) const
Returns true if this builtin does not perform the side-effects of its arguments.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
const char * getTypeString(unsigned ID) const
Get the type descriptor string for the specified builtin.
const char * getHeaderName(unsigned ID) const
If this is a library function that comes from a specific header, retrieve that header name...
bool isReturnsTwice(unsigned ID) const
Return true if we know this builtin can return twice.
bool isPure(unsigned ID) const
Return true if this function has no side effects.
Exposes information about the current target.
bool isNoThrow(unsigned ID) const
Return true if we know this builtin never throws an exception.
const char * getName(unsigned ID) const
Return the identifier name for the specified builtin, e.g.
Implements an efficient mapping from strings to IdentifierInfo nodes.
bool hasCustomTypechecking(unsigned ID) const
Determines whether this builtin has custom typechecking.
bool isConst(unsigned ID) const
Return true if this function has no side effects and doesn't read memory.
bool isPredefinedRuntimeFunction(unsigned ID) const
Determines whether this builtin is a predefined compiler-rt/libgcc function, such as "__clear_cache"...
This names the __make_integer_seq BuiltinTemplateDecl.
const char * getRequiredFeatures(unsigned ID) const
bool isConstWithoutErrno(unsigned ID) const
Return true if this function has no side effects and doesn't read memory, except for possibly errno...
void initializeBuiltins(IdentifierTable &Table, const LangOptions &LangOpts)
Mark the identifiers for all the builtins with their appropriate builtin ID # and mark any non-portab...
unsigned getAuxBuiltinID(unsigned ID) const
Return real buitin ID (i.e.
BuiltinTemplateKind
Kinds of BuiltinTemplateDecl.
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 isTSBuiltin(unsigned ID) const
Return true if this function is a target-specific builtin.
This names the __type_pack_element BuiltinTemplateDecl.
bool isLibFunction(unsigned ID) const
Return true if this is a builtin for a libc/libm function, with a "__builtin_" prefix (e...
void InitializeTarget(const TargetInfo &Target, const TargetInfo *AuxTarget)
Perform target-specific initialization.