forked from OSchip/llvm-project
[libc] Add LLVM libc specific functions to llvm_libc_ext.td.
Also moved most of the common type definitions from libc/spec/stdc.td to libc/spec/spec.td so that they can be used to list functions in llvm_libc_ext.td. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D89436
This commit is contained in:
parent
56f6bf1a8d
commit
ba24ba7e9c
|
@ -14,7 +14,42 @@ def LLVMLibcExt : StandardSpec<"llvm_libc_ext"> {
|
|||
]
|
||||
>;
|
||||
|
||||
HeaderSpec Assert = HeaderSpec<
|
||||
"assert.h",
|
||||
[], // Macros
|
||||
[], // Types
|
||||
[], // Enumerations
|
||||
[
|
||||
FunctionSpec<
|
||||
"__assert_fail",
|
||||
RetValSpec<NoReturn>,
|
||||
[ArgSpec<ConstCharPtr>,
|
||||
ArgSpec<ConstCharPtr>,
|
||||
ArgSpec<UnsignedType>,
|
||||
ArgSpec<ConstCharPtr>,]
|
||||
|
||||
>,
|
||||
]
|
||||
>;
|
||||
|
||||
HeaderSpec Errno = HeaderSpec<
|
||||
"errno.h",
|
||||
[], // Macros
|
||||
[], // Types
|
||||
[], // Enumerations
|
||||
[
|
||||
FunctionSpec<
|
||||
"__errno_location",
|
||||
RetValSpec<IntPtr>,
|
||||
[ArgSpec<VoidType>]
|
||||
|
||||
>,
|
||||
]
|
||||
>;
|
||||
|
||||
let Headers = [
|
||||
String,
|
||||
Assert,
|
||||
Errno,
|
||||
];
|
||||
}
|
||||
|
|
|
@ -48,12 +48,41 @@ def CharType : NamedType<"char">;
|
|||
def VoidPtr : PtrType<VoidType>;
|
||||
def ConstVoidPtr : ConstType<VoidPtr>;
|
||||
def SizeTType : NamedType<"size_t">;
|
||||
def FloatPtr : PtrType<FloatType>;
|
||||
def LongDoublePtr : PtrType<LongDoubleType>;
|
||||
|
||||
// _Noreturn is really not a type, but it is convenient to treat it as a type.
|
||||
def NoReturn : NamedType<"_Noreturn void">;
|
||||
|
||||
//types moved from stdc.td
|
||||
def VoidRestrictedPtr : RestrictedPtrType<VoidType>;
|
||||
def ConstVoidRestrictedPtr : ConstType<VoidRestrictedPtr>;
|
||||
|
||||
def CharPtr : PtrType<CharType>;
|
||||
def ConstCharPtr : ConstType<CharPtr>;
|
||||
def CharRestrictedPtr : RestrictedPtrType<CharType>;
|
||||
def ConstCharRestrictedPtr : ConstType<CharRestrictedPtr>;
|
||||
|
||||
def OnceFlagType : NamedType<"once_flag">;
|
||||
def OnceFlagTypePtr : PtrType<OnceFlagType>;
|
||||
// TODO(sivachandra): Remove this non-standard type when a formal
|
||||
// way to describe callable types is available.
|
||||
def CallOnceFuncType : NamedType<"__call_once_func_t">;
|
||||
def MtxTType : NamedType<"mtx_t">;
|
||||
def MtxTTypePtr : PtrType<MtxTType>;
|
||||
def ThrdStartTType : NamedType<"thrd_start_t">;
|
||||
def ThrdTType : NamedType<"thrd_t">;
|
||||
def ThrdTTypePtr : PtrType<ThrdTType>;
|
||||
|
||||
def IntPtr : PtrType<IntType>;
|
||||
def FloatPtr : PtrType<FloatType>;
|
||||
def DoublePtr : PtrType<DoubleType>;
|
||||
|
||||
def SigHandlerT : NamedType<"__sighandler_t">;
|
||||
|
||||
//added because __assert_fail needs it.
|
||||
def UnsignedType : NamedType<"unsigned">;
|
||||
|
||||
|
||||
class Macro<string name> {
|
||||
string Name = name;
|
||||
}
|
||||
|
|
|
@ -1,29 +1,4 @@
|
|||
def StdC : StandardSpec<"stdc"> {
|
||||
ConstType ConstVoidPtr = ConstType<VoidPtr>;
|
||||
RestrictedPtrType VoidRestrictedPtr = RestrictedPtrType<VoidType>;
|
||||
ConstType ConstVoidRestrictedPtr = ConstType<VoidRestrictedPtr>;
|
||||
|
||||
PtrType CharPtr = PtrType<CharType>;
|
||||
ConstType ConstCharPtr = ConstType<CharPtr>;
|
||||
RestrictedPtrType CharRestrictedPtr = RestrictedPtrType<CharType>;
|
||||
ConstType ConstCharRestrictedPtr = ConstType<CharRestrictedPtr>;
|
||||
|
||||
NamedType OnceFlagType = NamedType<"once_flag">;
|
||||
PtrType OnceFlagTypePtr = PtrType<OnceFlagType>;
|
||||
// TODO(sivachandra): Remove this non-standard type when a formal
|
||||
// way to describe callable types is available.
|
||||
NamedType CallOnceFuncType = NamedType<"__call_once_func_t">;
|
||||
NamedType MtxTType = NamedType<"mtx_t">;
|
||||
PtrType MtxTTypePtr = PtrType<MtxTType>;
|
||||
NamedType ThrdStartTType = NamedType<"thrd_start_t">;
|
||||
NamedType ThrdTType = NamedType<"thrd_t">;
|
||||
PtrType ThrdTTypePtr = PtrType<ThrdTType>;
|
||||
|
||||
PtrType IntPtr = PtrType<IntType>;
|
||||
PtrType FloatPtr = PtrType<FloatType>;
|
||||
PtrType DoublePtr = PtrType<DoubleType>;
|
||||
|
||||
NamedType SigHandlerT = NamedType<"__sighandler_t">;
|
||||
|
||||
NamedType FILE = NamedType<"FILE">;
|
||||
PtrType FILEPtr = PtrType<FILE>;
|
||||
|
|
Loading…
Reference in New Issue