CType
public protocol CType: CustomStringConvertible
The type of an element in the abstract syntax tree.
-
Converts the receiver to a
CXTypeto 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.invalidif the type declaration is invalid.TypeLayoutError.incompleteif the type declaration is an incomplete typeTypeLayoutError.dependentif the type declaration is dependent
Declaration
Swift
public func sizeOf() throws -> IntReturn 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.invalidif the type declaration is invalid.TypeLayoutError.incompleteif the type declaration is an incomplete typeTypeLayoutError.dependentif the type declaration is dependentTypeLayoutError.nonConstantSizeif the type is not a constant size
Declaration
Swift
public func alignOf() throws -> IntReturn Value
The alignment of the given type, in bytes.
-
descriptionExtension 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 -
declarationExtension methodRetrieves the cursor for the declaration of the receiver.
Declaration
Swift
public var declaration: Cursor? -
objcEncodingExtension methodRetrieves the Objective-C type encoding for the receiver.
Declaration
Swift
public var objcEncoding: String -
canonicalTypeExtension 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 -
cxxRefQualifierExtension 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?
CType Protocol Reference