c/clang:type size

This commit is contained in:
luoliwoshang
2024-12-12 18:16:40 +08:00
parent 5936b57bac
commit a4d3bf3cb2
2 changed files with 57 additions and 0 deletions

View File

@@ -111,6 +111,8 @@ long long wrap_clang_getArraySize(CXType *arrayTyp) { return clang_getArraySize(
void wrap_clang_Type_getNamedType(CXType *typ, CXType *namedTyp) { *namedTyp = clang_Type_getNamedType(*typ); }
long long wrap_clang_Type_getSizeOf(CXType *typ) { return clang_Type_getSizeOf(*typ); }
unsigned wrap_clang_Cursor_isAnonymous(CXCursor *cursor) { return clang_Cursor_isAnonymous(*cursor); }
unsigned wrap_clang_Cursor_isAnonymousRecordDecl(CXCursor *cursor) {

View File

@@ -2148,6 +2148,61 @@ func (t Type) NamedType() (ret Type) {
return
}
/**
* List the possible error codes for \c clang_Type_getSizeOf,
* \c clang_Type_getAlignOf, \c clang_Type_getOffsetOf and
* \c clang_Cursor_getOffsetOf.
*
* A value of this enumeration type can be returned if the target type is not
* a valid argument to sizeof, alignof or offsetof.
*/
type LayoutError c.Int
const (
/**
* Type is of kind CXType_Invalid.
*/
LayoutErrorInvalid LayoutError = -1
/**
* The type is an incomplete Type.
*/
LayoutErrorIncomplete LayoutError = -2
/**
* The type is a dependent Type.
*/
LayoutErrorDependent LayoutError = -3
/**
* The type is not a constant size type.
*/
LayoutErrorNotConstantSize LayoutError = -4
/**
* The Field name is not valid for this record.
*/
LayoutErrorInvalidFieldName LayoutError = -5
/**
* The type is undeduced.
*/
LayoutErrorUndeduced LayoutError = -6
)
/**
* Return the size of a type in bytes as per C++[expr.sizeof] standard.
*
* If the type declaration is invalid, CXTypeLayoutError_Invalid is returned.
* If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete
* is returned.
* If the type declaration is a dependent type, CXTypeLayoutError_Dependent is
* returned.
*/
// llgo:link (*Type).wrapSizeOf C.wrap_clang_Type_getSizeOf
func (t *Type) wrapSizeOf() (ret c.LongLong) {
return 0
}
func (t Type) SizeOf() (ret c.LongLong) {
return t.wrapSizeOf()
}
/**
* Determine whether the given cursor represents an anonymous
* tag or namespace