Skip to content
This repository has been archived by the owner on May 18, 2024. It is now read-only.

Commit

Permalink
loadFile: srcFile can be empty
Browse files Browse the repository at this point in the history
  • Loading branch information
xushiwei committed Jul 24, 2022
1 parent 2c1bdea commit f3889a8
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions cl/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,9 @@ func loadFile(p *gox.Package, conf *Config, file *ast.Node) (pi *PkgInfo, err er
if file.Kind != ast.TranslationUnitDecl {
return nil, syscall.EINVAL
}
baseDir, err := filepath.Abs(conf.Dir)
if err != nil {
return
}
srcFile, err := filepath.Abs(conf.SrcFile)
if err != nil {
return
srcFile := conf.SrcFile
if srcFile != "" {
srcFile, _ = filepath.Abs(srcFile)
}
ctx := &blockCtx{
pkg: p, cb: p.CB(), fset: p.Fset,
Expand All @@ -276,6 +272,7 @@ func loadFile(p *gox.Package, conf *Config, file *ast.Node) (pi *PkgInfo, err er
bfm: conf.BuiltinFuncMode,
testMain: conf.TestMain,
}
baseDir, _ := filepath.Abs(conf.Dir)
ctx.initMultiFileCtl(p, baseDir, conf)
ctx.initCTypes()
ctx.initFile()
Expand Down

0 comments on commit f3889a8

Please sign in to comment.