15 #ifndef LLVM_CLANG_BASIC_BUILTINS_H 16 #define LLVM_CLANG_BASIC_BUILTINS_H 18 #include "llvm/ADT/ArrayRef.h" 27 class IdentifierTable;
50 #define BUILTIN(ID, TYPE, ATTRS) BI##ID, 51 #include "clang/Basic/Builtins.def" 86 return getRecord(ID).Name;
91 return getRecord(ID).Type;
101 return strchr(getRecord(ID).
Attributes,
'U') !=
nullptr;
107 return strchr(getRecord(ID).
Attributes,
'c') !=
nullptr;
112 return strchr(getRecord(ID).
Attributes,
'n') !=
nullptr;
117 return strchr(getRecord(ID).
Attributes,
'r') !=
nullptr;
122 return strchr(getRecord(ID).
Attributes,
'j') !=
nullptr;
128 return strchr(getRecord(ID).
Attributes,
'u') !=
nullptr;
134 return strchr(getRecord(ID).
Attributes,
'F') !=
nullptr;
141 return strchr(getRecord(ID).
Attributes,
'f') !=
nullptr;
148 return strchr(getRecord(ID).
Attributes,
'h') !=
nullptr;
155 return strchr(getRecord(ID).
Attributes,
'i') !=
nullptr;
160 return strchr(getRecord(ID).
Attributes,
't') !=
nullptr;
166 return strchr(getRecord(ID).
Type,
'*') !=
nullptr;
172 return strchr(getRecord(ID).
Type,
'&') !=
nullptr ||
173 strchr(getRecord(ID).Type,
'A') !=
nullptr;
183 return getRecord(ID).HeaderName;
189 bool isPrintfLike(
unsigned ID,
unsigned &FormatIdx,
bool &HasVAListArg);
194 bool isScanfLike(
unsigned ID,
unsigned &FormatIdx,
bool &HasVAListArg);
199 bool performsCallback(
unsigned ID,
207 return strchr(getRecord(ID).
Attributes,
'e') !=
nullptr;
211 return getRecord(ID).Features;
214 unsigned getRequiredVectorWidth(
unsigned ID)
const;
227 static bool isBuiltinFunc(
const char *
Name);
231 bool canBeRedeclared(
unsigned ID)
const;
234 const Info &getRecord(
unsigned ID)
const;
241 bool isLike(
unsigned ID,
unsigned &FormatIdx,
bool &HasVAListArg,
242 const char *Fmt)
const;
const char * getHeaderName(unsigned ID) const
If this is a library function that comes from a specific header, retrieve that header name...
bool isPure(unsigned ID) const
Return true if this function has no side effects.
bool hasReferenceArgsOrResult(unsigned ID) const
Return true if this builtin has a result or any arguments which are reference types.
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.
Holds information about both target-independent and target-specific builtins, allowing easy queries b...
static const Builtin::Info BuiltinInfo[]
The base class of the type hierarchy.
const char * getTypeString(unsigned ID) const
Get the type descriptor string for the specified builtin.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
bool isLibFunction(unsigned ID) const
Return true if this is a builtin for a libc/libm function, with a "__builtin_" prefix (e...
bool isConstWithoutErrno(unsigned ID) const
Return true if this function has no side effects and doesn't read memory, except for possibly errno...
unsigned getAuxBuiltinID(unsigned ID) const
Return real builtin ID (i.e.
bool isUnevaluated(unsigned ID) const
Returns true if this builtin does not perform the side-effects of its arguments.
const char * getName(unsigned ID) const
Return the identifier name for the specified builtin, e.g.
Exposes information about the current target.
bool isNoReturn(unsigned ID) const
Return true if we know this builtin never returns.
Implements an efficient mapping from strings to IdentifierInfo nodes.
bool isPredefinedRuntimeFunction(unsigned ID) const
Determines whether this builtin is a predefined compiler-rt/libgcc function, such as "__clear_cache"...
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.
bool isAuxBuiltinID(unsigned ID) const
Return true if builtin ID belongs to AuxTarget.
This names the __make_integer_seq BuiltinTemplateDecl.
bool isConst(unsigned ID) const
Return true if this function has no side effects and doesn't read memory.
BuiltinTemplateKind
Kinds of BuiltinTemplateDecl.
bool isHeaderDependentFunction(unsigned ID) const
Returns true if this builtin requires appropriate header in other compilers.
Dataflow Directional Tag Classes.
This names the __type_pack_element BuiltinTemplateDecl.
bool isNoThrow(unsigned ID) const
Return true if we know this builtin never throws an exception.
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 isReturnsTwice(unsigned ID) const
Return true if we know this builtin can return twice.