llcppsigfetch:use fmt to log because linux nil defer of log

This commit is contained in:
luoliwoshang
2024-10-23 15:13:14 +08:00
parent a608c51e36
commit 91ebf88c97
3 changed files with 31 additions and 33 deletions

View File

@@ -2,7 +2,8 @@ package parse
import (
"errors"
"log"
"fmt"
"os"
"github.com/goplus/llgo/c/cjson"
"github.com/goplus/llgo/chore/_xtool/llcppsymg/clangutils"
@@ -42,7 +43,7 @@ func (p *Context) Output() *cjson.JSON {
// ProcessFiles processes the given files and adds them to the context
func (p *Context) ProcessFiles(files []string) error {
if debugParse {
log.Println("ProcessFiles: files", files, "isCpp", p.IsCpp)
fmt.Fprintln(os.Stderr, "ProcessFiles: files", files, "isCpp", p.IsCpp)
}
for _, file := range files {
if err := p.processFile(file); err != nil {
@@ -55,12 +56,12 @@ func (p *Context) ProcessFiles(files []string) error {
// parse file and add it to the context,avoid duplicate parsing
func (p *Context) processFile(path string) error {
if debugParse {
log.Println("processFile: path", path)
fmt.Fprintln(os.Stderr, "processFile: path", path)
}
for _, entry := range p.Files {
if entry.Path == path {
if debugParse {
log.Println("processFile: already parsed", path)
fmt.Fprintln(os.Stderr, "processFile: already parsed", path)
}
return nil
}
@@ -76,7 +77,7 @@ func (p *Context) processFile(path string) error {
func (p *Context) parseFile(path string) ([]*FileEntry, error) {
if debugParse {
log.Println("parseFile: path", path)
fmt.Fprintln(os.Stderr, "parseFile: path", path)
}
converter, err := NewConverter(&clangutils.Config{
File: path,