16 #ifndef LLVM_CLANG_BASIC_BUILTINS_H
17 #define LLVM_CLANG_BASIC_BUILTINS_H
28 class IdentifierTable;
47 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
48 #include "clang/Basic/Builtins.def"
67 const Info *TSRecords;
68 unsigned NumTSRecords;
86 return GetRecord(ID).
Name;
91 return GetRecord(ID).
Type;
97 return strchr(GetRecord(ID).Attributes,
'c') !=
nullptr;
102 return strchr(GetRecord(ID).Attributes,
'n') !=
nullptr;
107 return strchr(GetRecord(ID).Attributes,
'r') !=
nullptr;
112 return strchr(GetRecord(ID).Attributes,
'j') !=
nullptr;
118 return strchr(GetRecord(ID).Attributes,
'u') !=
nullptr;
124 return strchr(GetRecord(ID).Attributes,
'F') !=
nullptr;
131 return strchr(GetRecord(ID).Attributes,
'f') !=
nullptr;
138 return strchr(GetRecord(ID).Attributes,
'i') !=
nullptr;
143 return strchr(GetRecord(ID).Attributes,
't') !=
nullptr;
149 return strchr(GetRecord(ID).
Type,
'*') !=
nullptr;
165 bool isPrintfLike(
unsigned ID,
unsigned &FormatIdx,
bool &HasVAListArg);
170 bool isScanfLike(
unsigned ID,
unsigned &FormatIdx,
bool &HasVAListArg);
177 return strchr(GetRecord(ID).Attributes,
'e') !=
nullptr;
181 const Info &GetRecord(
unsigned ID)
const;
188 bool isLike(
unsigned ID,
unsigned &FormatIdx,
bool &HasVAListArg,
189 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.
bool operator==(const Info &RHS) const
static const Builtin::Info BuiltinInfo[]
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...
void GetBuiltinNames(SmallVectorImpl< const char * > &Names)
Populate the vector with the names of all of the builtins.
bool hasPtrArgsOrResult(unsigned ID) const
Determines whether this builtin has a result or any arguments which are pointer types.
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...
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
bool operator!=(const Info &RHS) const
const char * getHeaderName(unsigned ID) const
If this is a library function that comes from a specific header, retrieve that header name...
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 isReturnsTwice(unsigned ID) const
Return true if we know this builtin can return twice.
Exposes information about the current target.
bool isNoThrow(unsigned ID) const
Return true if we know this builtin never throws an exception.
Implements an efficient mapping from strings to IdentifierInfo nodes.
void InitializeTarget(const TargetInfo &Target)
Perform target-specific initialization.
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"...
bool isConstWithoutErrno(unsigned ID) const
Return true if this function has no side effects and doesn't read memory, except for possibly errno...
const char * GetName(unsigned ID) const
Return the identifier name for the specified builtin, e.g. "__builtin_abs".
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...
const char * GetTypeString(unsigned ID) const
Get the type descriptor string for the specified builtin.
bool isLibFunction(unsigned ID) const
Return true if this is a builtin for a libc/libm function, with a "__builtin_" prefix (e...
void InitializeBuiltins(IdentifierTable &Table, const LangOptions &LangOpts)
Mark the identifiers for all the builtins with their appropriate builtin ID # and mark any non-portab...