CType
public protocol CType: CustomStringConvertible
The type of an element in the abstract syntax tree.
-
Converts the receiver to a
CXType
to be consumed by the libclang APIs.Declaration
Swift
func asClang() -> CXType
-
sizeOf()
Extension methodComputes the size of a type in bytes as per C++ [expr.sizeof] standard.
Throws
TypeLayoutError.invalid
if the type declaration is invalid.TypeLayoutError.incomplete
if the type declaration is an incomplete typeTypeLayoutError.dependent
if the type declaration is dependent
Declaration
Swift
public func sizeOf() throws -> Int
Return Value
The size of the type in bytes.
-
alignOf()
Extension methodComputes the alignment of a type in bytes as per C++[expr.alignof] standard.
Throws
TypeLayoutError.invalid
if the type declaration is invalid.TypeLayoutError.incomplete
if the type declaration is an incomplete typeTypeLayoutError.dependent
if the type declaration is dependentTypeLayoutError.nonConstantSize
if the type is not a constant size
Declaration
Swift
public func alignOf() throws -> Int
Return Value
The alignment of the given type, in bytes.
-
description
Extension methodPretty-print the underlying type using the rules of the language of the translation unit from which it came.
Note
If the type is invalid, an empty string is returned.Declaration
Swift
public var description: String
-
declaration
Extension methodRetrieves the cursor for the declaration of the receiver.
Declaration
Swift
public var declaration: Cursor?
-
objcEncoding
Extension methodRetrieves the Objective-C type encoding for the receiver.
Declaration
Swift
public var objcEncoding: String
-
canonicalType
Extension methodReturn the canonical type for a CType. Clang’s type system explicitly models typedefs and all the ways a specific type can be represented. The canonical type is the underlying type with all the
sugar
removed. For example, if ‘T’ is a typedef for ‘int’, the canonical type for ‘T’ would be ‘int’.Declaration
Swift
public var canonicalType: CType
-
cxxRefQualifier
Extension methodRetrieve the ref-qualifier kind of a function or method. The ref-qualifier is returned for C++ functions or methods. For other types or non-C++ declarations, nil is returned.
Declaration
Swift
public var cxxRefQualifier: RefQualifier?