llcppsigfetch:based on language configuration analysis

This commit is contained in:
luoliwoshang
2024-09-06 11:44:56 +08:00
parent ae71f3c186
commit 07519732a1
5 changed files with 82 additions and 32 deletions

View File

@@ -10,11 +10,13 @@ import (
type Context struct {
Files map[string]*ast.File
IsCpp bool
}
func NewContext() *Context {
func NewContext(isCpp bool) *Context {
return &Context{
Files: make(map[string]*ast.File),
IsCpp: isCpp,
}
}
@@ -60,8 +62,9 @@ func (p *Context) processFile(path string) error {
func (p *Context) parseFile(path string) (map[string]*ast.File, error) {
converter, err := NewConverter(&Config{
File: path,
Temp: false,
File: path,
Temp: false,
IsCpp: p.IsCpp,
})
if err != nil {
return nil, errors.New("failed to create converter " + path)