Skip to content

Commit

Permalink
cmd: Include lib and fix stderr in 3rdpartycompile
Browse files Browse the repository at this point in the history
  • Loading branch information
sangisos committed Aug 30, 2016
1 parent b22ec7b commit e5482c0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cmd/3rdpartycompile/3rdpartycompile.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ import (
"log"
"os"
"os/exec"
"path/filepath"
"strings"

"github.com/mewkiz/pkg/errutil"
"github.com/mewkiz/pkg/goutil"
"github.com/mewkiz/pkg/ioutilx"
"github.com/mewmew/uc/ast"
goccerrors "github.com/mewmew/uc/gocc/errors"
Expand Down Expand Up @@ -134,8 +136,14 @@ func compileFile(path string, outputPath string, goccLexer bool) error {

// Generate LLVM IR module based on the syntax tree of the given file.
module := irgen.Gen(file, info)
clang := exec.Command("clang", "-o", outputPath, "-x", "ir", "-")
lib, err := goutil.SrcDir("github.com/mewmew/uc/testdata")
if err != nil {
return errutil.Err(err)
}
clang := exec.Command("clang", "-o", outputPath, "-x", "ir", filepath.Join(lib, "uc.ll"), "-")
clang.Stdin = strings.NewReader(module.String())
clang.Stderr = os.Stderr
clang.Stdout = os.Stdout
if err := clang.Run(); err != nil {
return errutil.Err(err)
}
Expand Down

0 comments on commit e5482c0

Please sign in to comment.