cgo: include all enums in the CGo Go AST

Not all enums may be used as a type anywhere, which was previously the
only way to include an enum in the AST. This commit makes sure all enums
are included.
This commit is contained in:
Ayke van Laethem
2019-11-06 12:08:31 +01:00
committed by Ron Evans
parent d31deda1b5
commit 76c9f13e13
3 changed files with 10 additions and 0 deletions
+5
View File
@@ -255,6 +255,11 @@ func tinygo_clang_globals_visitor(c, parent C.GoCXCursor, client_data C.CXClient
// Parsing was successful.
p.constants[name] = constantInfo{expr, pos}
}
case C.CXCursor_EnumDecl:
// Visit all enums, because the fields may be used even when the enum
// type itself is not.
typ := C.tinygo_clang_getCursorType(c)
p.makeASTType(typ, pos)
}
return C.CXChildVisit_Continue
}