aboutsummaryrefslogtreecommitdiffhomepage
path: root/cgo/libclang.go
diff options
context:
space:
mode:
Diffstat (limited to 'cgo/libclang.go')
-rw-r--r--cgo/libclang.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/cgo/libclang.go b/cgo/libclang.go
index efefe370b..a4817a4f1 100644
--- a/cgo/libclang.go
+++ b/cgo/libclang.go
@@ -245,9 +245,12 @@ func tinygo_clang_globals_visitor(c, parent C.GoCXCursor, client_data C.CXClient
p.addError(pos, fmt.Sprintf("internal error: expected macro value to start with %#v, got %#v", name, source))
break
}
- value := strings.TrimSpace(source[len(name):])
+ value := source[len(name):]
// Try to convert this #define into a Go constant expression.
- expr := parseConst(pos, value)
+ expr, err := parseConst(pos+token.Pos(len(name)), p.fset, value)
+ if err != nil {
+ p.errors = append(p.errors, err)
+ }
if expr != nil {
// Parsing was successful.
p.constants[name] = constantInfo{expr, pos}