-
Notifications
You must be signed in to change notification settings - Fork 0
/
type.go
43 lines (32 loc) · 777 Bytes
/
type.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package libclang
// #include <clang-c/Index.h>
import "C"
import (
"strings"
)
type Type C.CXType
func (t Type) c() C.CXType {
return C.CXType(t)
}
func (t Type) Spelling() string {
return cxString(C.clang_getTypeSpelling(t.c()))
}
func (t Type) IsConst() bool {
return C.clang_isConstQualifiedType(t.c()) > 0 ||
strings.HasPrefix(t.Spelling(), "const ")
}
func (t Type) CanonicalType() Type {
return Type(C.clang_getCanonicalType(t.c()))
}
func (t Type) PointeeType() Type {
return Type(C.clang_getPointeeType(t.c()))
}
func (t Type) Kind() TypeKind {
return TypeKind(t.kind)
}
func (t Type) IsFunctionTypeVariadic() bool {
return C.clang_isFunctionTypeVariadic(t.c()) == 1
}
func (t Type) ResultType() Type {
return Type(C.clang_getResultType(t.c()))
}