@@ -7,36 +7,54 @@ import (
77)
88
99type Condition struct {
10- OS []string `json:"os"`
11- Arch []string `json:"arch"`
10+ OS []string `json:"os,omitempty "`
11+ Arch []string `json:"arch,omitempty "`
1212}
1313
1414type ImplFiles struct {
15- Files []string `json:"files"`
16- Cond Condition `json:"cond"`
15+ Files []string `json:"files,omitempty "`
16+ Cond Condition `json:"cond,omitempty "`
1717}
1818
1919// Config represents a configuration for the llcppg tool.
2020type Config struct {
2121 Name string `json:"name"`
2222 CFlags string `json:"cflags"`
2323 // NOTE(MeterosLiu): libs can be empty when we're in headerOnly mode
24- Libs string `json:"libs,omitempty "`
24+ Libs string `json:"libs"`
2525 Include []string `json:"include"`
26- TrimPrefixes []string `json:"trimPrefixes,omitempty "`
27- Cplusplus bool `json:"cplusplus,omitempty "`
28- Deps []string `json:"deps,omitempty "`
29- KeepUnderScore bool `json:"keepUnderScore,omitempty "`
26+ TrimPrefixes []string `json:"trimPrefixes"`
27+ Cplusplus bool `json:"cplusplus"`
28+ Deps []string `json:"deps"`
29+ KeepUnderScore bool `json:"keepUnderScore"`
3030 Impl []ImplFiles `json:"impl,omitempty"`
31- Mix bool `json:"mix,omitempty "`
32- SymMap map [string ]string `json:"symMap,omitempty "`
33- TypeMap map [string ]string `json:"typeMap,omitempty "`
34- StaticLib bool `json:"staticLib,omitempty "`
35- HeaderOnly bool `json:"headerOnly,omitempty "`
31+ Mix bool `json:"mix"`
32+ SymMap map [string ]string `json:"symMap"`
33+ TypeMap map [string ]string `json:"typeMap"`
34+ StaticLib bool `json:"staticLib"`
35+ HeaderOnly bool `json:"headerOnly"`
3636}
3737
38+ // To make it easier for users to set up configuration files without
39+ // having to remember various fields, the configuration file is written
40+ // with all empty fields by default except for the Impl field.
3841func NewDefault () * Config {
39- return & Config {}
42+ return & Config {
43+ Name : "" ,
44+ CFlags : "" ,
45+ Libs : "" ,
46+ Include : []string {},
47+ TrimPrefixes : []string {},
48+ Cplusplus : false ,
49+ Deps : []string {},
50+ KeepUnderScore : false ,
51+ Impl : []ImplFiles {},
52+ Mix : false ,
53+ SymMap : map [string ]string {},
54+ TypeMap : map [string ]string {},
55+ StaticLib : false ,
56+ HeaderOnly : false ,
57+ }
4058}
4159
4260type SymbolInfo struct {
0 commit comments