MCPcopy Create free account
hub / github.com/google/gapid / ParseFunctionSignature

Method ParseFunctionSignature

core/codegen/module.go:188–197  ·  view source on GitHub ↗

ParseFunctionSignature returns a function parsed from a C-style signature. Example: "void* Foo(uint8_t i, bool b)"

(sig string)

Source from the content-addressed store, hash-verified

186// Example:
187// "void* Foo(uint8_t i, bool b)"
188func (m *Module) ParseFunctionSignature(sig string) *Function {
189 parts := parseFuncRE.FindStringSubmatch(sig)
190 if len(parts) != 4 {
191 fail("'%v' is not a valid function signature", sig)
192 }
193 ret := m.parseType(parts[1])
194 name := parts[2]
195 args := m.parseTypes(strings.Split(parts[3], ","))
196 return m.Function(ret, name, args...)
197}
198
199func (m *Module) parseTypes(l []string) []Type {
200 out := make([]Type, len(l))

Callers 4

declareCallbacksMethod · 0.80
parseCallbacksMethod · 0.80
parseCallbacksMethod · 0.80
parseCallbacksMethod · 0.80

Calls 5

parseTypeMethod · 0.95
parseTypesMethod · 0.95
FunctionMethod · 0.95
failFunction · 0.70
SplitMethod · 0.45

Tested by

no test coverage detected