llcppsigfetch:output fileset
This commit is contained in:
@@ -137,7 +137,7 @@ func runExtract() {
|
||||
check(err)
|
||||
_, err = converter.Convert()
|
||||
check(err)
|
||||
result := converter.MarshalASTFiles()
|
||||
result := converter.MarshalOutputASTFiles()
|
||||
cstr := result.Print()
|
||||
c.Printf(cstr)
|
||||
cjson.FreeCStr(cstr)
|
||||
|
||||
@@ -872,6 +872,10 @@ func (ct *Converter) MarshalASTFiles() *cjson.JSON {
|
||||
return MarshalASTFiles(ct.Files)
|
||||
}
|
||||
|
||||
func (ct *Converter) MarshalOutputASTFiles() *cjson.JSON {
|
||||
return MarshalOutputASTFiles(ct.Files)
|
||||
}
|
||||
|
||||
func IsExplicitSigned(t clang.Type) bool {
|
||||
return t.Kind == clang.TypeCharS || t.Kind == clang.TypeSChar
|
||||
}
|
||||
|
||||
@@ -6,6 +6,18 @@ import (
|
||||
"github.com/goplus/llgo/chore/llcppg/ast"
|
||||
)
|
||||
|
||||
func MarshalOutputASTFiles(files map[string]*ast.File) *cjson.JSON {
|
||||
root := cjson.Array()
|
||||
for path, file := range files {
|
||||
f := cjson.Object()
|
||||
path := cjson.String(c.AllocaCStr(path))
|
||||
f.SetItem(c.Str("path"), path)
|
||||
f.SetItem(c.Str("doc"), MarshalASTFile(file))
|
||||
root.AddItem(f)
|
||||
}
|
||||
return root
|
||||
}
|
||||
|
||||
func MarshalASTFiles(files map[string]*ast.File) *cjson.JSON {
|
||||
root := cjson.Object()
|
||||
for path, file := range files {
|
||||
|
||||
@@ -3,7 +3,6 @@ package parse
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/goplus/llgo/c"
|
||||
"github.com/goplus/llgo/c/cjson"
|
||||
"github.com/goplus/llgo/chore/llcppg/ast"
|
||||
)
|
||||
@@ -21,15 +20,7 @@ func NewContext(isCpp bool) *Context {
|
||||
}
|
||||
|
||||
func (p *Context) Output() *cjson.JSON {
|
||||
root := cjson.Array()
|
||||
for path, file := range p.Files {
|
||||
f := cjson.Object()
|
||||
path := cjson.String(c.AllocaCStr(path))
|
||||
f.SetItem(c.Str("path"), path)
|
||||
f.SetItem(c.Str("doc"), MarshalASTFile(file))
|
||||
root.AddItem(f)
|
||||
}
|
||||
return root
|
||||
return MarshalOutputASTFiles(p.Files)
|
||||
}
|
||||
|
||||
// ProcessFiles processes the given files and adds them to the context
|
||||
|
||||
Reference in New Issue
Block a user