mirror of
https://github.com/danog/gllvm.git
synced 2024-11-26 21:34:47 +01:00
fix print only case
This commit is contained in:
parent
09ffb6d8e4
commit
0cf14152fe
@ -31,18 +31,18 @@ func Compile(args []string, compilerName string) (exitCode int) {
|
||||
var pr = parse(args)
|
||||
|
||||
var wg sync.WaitGroup
|
||||
// If configure only is set, just execute the compiler
|
||||
|
||||
if configureOnly {
|
||||
// If configure only or print only are set, just execute the compiler
|
||||
if configureOnly || pr.IsPrintOnly {
|
||||
wg.Add(1)
|
||||
go execCompile(compilerExecName, pr, &wg, &ok)
|
||||
wg.Wait()
|
||||
// Else try to build bitcode as well
|
||||
|
||||
if !ok {
|
||||
exitCode = 1
|
||||
}
|
||||
|
||||
// Else try to build bitcode as well
|
||||
} else {
|
||||
var bcObjLinks []bitcodeToObjectLink
|
||||
var newObjectFiles []string
|
||||
|
@ -25,6 +25,7 @@ type parserResult struct {
|
||||
IsAssembly bool
|
||||
IsCompileOnly bool
|
||||
IsEmitLLVM bool
|
||||
IsPrintOnly bool
|
||||
}
|
||||
|
||||
type flagInfo struct {
|
||||
@ -37,6 +38,7 @@ func parse(argList []string) parserResult {
|
||||
pr.InputList = argList
|
||||
|
||||
var argsExactMatches = map[string]flagInfo{
|
||||
"-": {0, pr.printOnlyCallback},
|
||||
"-o": {1, pr.outputFileCallback},
|
||||
"-c": {0, pr.compileOnlyCallback},
|
||||
"-E": {0, pr.preprocessOnlyCallback},
|
||||
@ -194,7 +196,7 @@ func parse(argList []string) parserResult {
|
||||
`^-print-file-name=.*$`: {0, pr.compileUnaryCallback},
|
||||
}
|
||||
|
||||
for len(argList) > 0 && !(pr.IsAssembly || pr.IsAssembleOnly || pr.IsPreprocessOnly) {
|
||||
for len(argList) > 0 {
|
||||
var elem = argList[0]
|
||||
|
||||
// Try to match the flag exactly
|
||||
@ -279,6 +281,10 @@ func (pr *parserResult) dependencyOnlyCallback(flag string, _ []string) {
|
||||
pr.CompileArgs = append(pr.CompileArgs, flag)
|
||||
}
|
||||
|
||||
func (pr *parserResult) printOnlyCallback(flag string, _ []string) {
|
||||
pr.IsPrintOnly = true
|
||||
}
|
||||
|
||||
func (pr *parserResult) assembleOnlyCallback(_ string, _ []string) {
|
||||
pr.IsAssembleOnly = true
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ func execCmd(cmdExecName string, args []string, workingDir string) (success bool
|
||||
cmd := exec.Command(cmdExecName, args...)
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
cmd.Stdin = os.Stdin
|
||||
cmd.Dir = workingDir
|
||||
err = cmd.Run()
|
||||
success = (err == nil)
|
||||
|
Loading…
Reference in New Issue
Block a user