summaryrefslogtreecommitdiffstats
path: root/llgo/cmd
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2014-12-31 00:25:32 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2014-12-31 00:25:32 +0000
commit9350942b20bf1e6e2b182159f5837ba209485972 (patch)
tree667c09eccb6f856dea1f5e9d640655faf15dbb82 /llgo/cmd
parentbc405294f047be809dc58639ad4d4af692b8bfaa (diff)
downloadbcm5719-llvm-9350942b20bf1e6e2b182159f5837ba209485972.tar.gz
bcm5719-llvm-9350942b20bf1e6e2b182159f5837ba209485972.zip
irgen, driver: modify Compiler.Compile to take a FileSet and Files
This change allows clients to generate IR using "files" received from locations other than the file system. The regular file parser is moved to a new library, "driver", which is intended to eventually contain much of the logic from the existing driver. Differential Revision: http://reviews.llvm.org/D6794 llvm-svn: 225026
Diffstat (limited to 'llgo/cmd')
-rw-r--r--llgo/cmd/gllgo/gllgo.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/llgo/cmd/gllgo/gllgo.go b/llgo/cmd/gllgo/gllgo.go
index db25ccf238f..e58686e57dc 100644
--- a/llgo/cmd/gllgo/gllgo.go
+++ b/llgo/cmd/gllgo/gllgo.go
@@ -23,6 +23,7 @@ import (
"errors"
"fmt"
"go/scanner"
+ "go/token"
"io/ioutil"
"log"
"os"
@@ -31,6 +32,7 @@ import (
"strings"
"llvm.org/llgo/debug"
+ "llvm.org/llgo/driver"
"llvm.org/llgo/irgen"
"llvm.org/llvm/bindings/go/llvm"
)
@@ -580,7 +582,13 @@ func performAction(opts *driverOptions, kind actionKind, inputs []string, output
return err
}
- module, err := compiler.Compile(inputs, opts.pkgpath)
+ fset := token.NewFileSet()
+ files, err := driver.ParseFiles(fset, inputs)
+ if err != nil {
+ return err
+ }
+
+ module, err := compiler.Compile(fset, files, opts.pkgpath)
if err != nil {
return err
}
OpenPOWER on IntegriCloud