Go to the documentation of this file.
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"
29 class IdentifierTable;
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.def"
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;
284 const Info &getRecord(
unsigned ID)
const;
287 bool isLike(
unsigned ID,
unsigned &FormatIdx,
bool &HasVAListArg,
288 const char *Fmt)
const;
296 llvm::StringRef RequiredFatures,
297 const llvm::StringMap<bool> &TargetFetureMap);
static bool isBuiltinFunc(llvm::StringRef Name)
Returns true if this is a libc/libm function without the '__builtin_' prefix.
bool isConstWithoutErrnoAndExceptions(unsigned ID) const
Return true if this function has no side effects and doesn't read memory, except for possibly errno o...
bool isLibFunction(unsigned ID) const
Return true if this is a builtin for a libc/libm function, with a "__builtin_" prefix (e....
Exposes information about the current target.
bool isConstantEvaluated(unsigned ID) const
Return true if this function can be constant evaluated by Clang frontend.
bool isPredefinedRuntimeFunction(unsigned ID) const
Determines whether this builtin is a predefined compiler-rt/libgcc function, such as "__clear_cache",...
The base class of the type hierarchy.
bool performsCallback(unsigned ID, llvm::SmallVectorImpl< int > &Encoding) const
Determine whether this builtin has callback behavior (see llvm::AbstractCallSites for details).
const char * getHeaderName(unsigned ID) const
If this is a library function that comes from a specific header, retrieve that header name.
const char * getRequiredFeatures(unsigned ID) const
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 isConstWithoutExceptions(unsigned ID) const
unsigned getAuxBuiltinID(unsigned ID) const
Return real builtin ID (i.e.
bool evaluateRequiredTargetFeatures(llvm::StringRef RequiredFatures, const llvm::StringMap< bool > &TargetFetureMap)
Returns true if the required target features of a builtin function are enabled.
bool isConst(unsigned ID) const
Return true if this function has no side effects and doesn't read memory.
const char * getTypeString(unsigned ID) const
Get the type descriptor string for the specified builtin.
bool isInStdNamespace(unsigned ID) const
Determines whether this builtin is a C++ standard library function that lives in (possibly-versioned)...
unsigned getRequiredVectorWidth(unsigned ID) const
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.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
bool hasReferenceArgsOrResult(unsigned ID) const
Return true if this builtin has a result or any arguments which are reference types.
bool isTSBuiltin(unsigned ID) const
Return true if this function is a target-specific builtin.
Holds information about both target-independent and target-specific builtins, allowing easy queries b...
bool canBeRedeclared(unsigned ID) const
Returns true if this is a builtin that can be redeclared.
bool allowTypeMismatch(unsigned ID) const
Determines whether a declaration of this builtin should be recognized even if the type doesn't match ...
bool isPure(unsigned ID) const
Return true if this function has no side effects.
Implements an efficient mapping from strings to IdentifierInfo nodes.
@ BTK__make_integer_seq
This names the __make_integer_seq BuiltinTemplateDecl.
bool isHeaderDependentFunction(unsigned ID) const
Returns true if this builtin requires appropriate header in other compilers.
bool isUnevaluated(unsigned ID) const
Returns true if this builtin does not perform the side-effects of its arguments.
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 hasCustomTypechecking(unsigned ID) const
Determines whether this builtin has custom typechecking.
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 isNoThrow(unsigned ID) const
Return true if we know this builtin never throws an exception.
@ BTK__type_pack_element
This names the __type_pack_element BuiltinTemplateDecl.
bool isAuxBuiltinID(unsigned ID) const
Return true if builtin ID belongs to AuxTarget.
BuiltinTemplateKind
Kinds of BuiltinTemplateDecl.
bool isReturnsTwice(unsigned ID) const
Return true if we know this builtin can return twice.
void initializeBuiltins(IdentifierTable &Table, const LangOptions &LangOpts)
Mark the identifiers for all the builtins with their appropriate builtin ID # and mark any non-portab...
void InitializeTarget(const TargetInfo &Target, const TargetInfo *AuxTarget)
Perform target-specific initialization.
bool isPredefinedLibFunction(unsigned ID) const
Determines whether this builtin is a predefined libc/libm function, such as "malloc",...