Skip to content

Commit

Permalink
Complaints from the peanut gallery.
Browse files Browse the repository at this point in the history
  • Loading branch information
ianamason committed Mar 24, 2020
1 parent 27ff069 commit 02ea4c5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
5 changes: 3 additions & 2 deletions shared/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ func init() {
FetchEnvironment()
}

// PrintEnvironment is used for printing the aspects of the environment that concern us
func PrintEnvironment() {
vars := []string{envpath, envcc, envcxx, envar, envlnk, envcfg, envbc, envlvl, envfile, envobjcopy, envld, envbcgen}

Expand All @@ -123,7 +124,7 @@ func PrintEnvironment() {

}

// also used in testing
// ResetEnvironment resets the globals, it is only used in testing
func ResetEnvironment() {
LLVMToolChainBinDir = ""
LLVMCCName = ""
Expand All @@ -139,7 +140,7 @@ func ResetEnvironment() {
LLVMbcGen = []string{}
}

// also used in testing
// FetchEnvironment is used in initializing our globals, it is also used in testing
func FetchEnvironment() {
LLVMToolChainBinDir = os.Getenv(envpath)
LLVMCCName = os.Getenv(envcc)
Expand Down
22 changes: 11 additions & 11 deletions shared/extractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import (
"strings"
)

//for distilling the desired commandline options
//ExtractionArgs encapsulate the results of parsing the commandline options
type ExtractionArgs struct {
Failure bool // indicates failure in parsing the cmd line args
Verbose bool // inform the user of what is going on
Expand Down Expand Up @@ -91,6 +91,7 @@ ea.ArchiverName: %v
ea.LlvmLinkerName, ea.ArchiverName)
}

//ParseSwitches parses the command line into an ExtractionArgs object.
func ParseSwitches(args []string) (ea ExtractionArgs) {

var flagSet *flag.FlagSet = flag.NewFlagSet(args[0], flag.ContinueOnError)
Expand Down Expand Up @@ -656,17 +657,16 @@ func linkBitcodeFiles(ea ExtractionArgs, filesToLink []string) (success bool) {
}
if getsize(filesToLink) > argMax { //command line size too large for the OS (necessitated by chromium)
return linkBitcodeFilesIncrementally(ea, filesToLink, argMax, linkArgs)
} else {
var err error
linkArgs = append(linkArgs, "-o", ea.OutputFile)
linkArgs = append(linkArgs, filesToLink...)
success, err = execCmd(ea.LlvmLinkerName, linkArgs, "")
if !success {
LogError("There was an error linking input files into %s because %v.\n", ea.OutputFile, err)
return
}
informUser("Bitcode file extracted to: %s.\n", ea.OutputFile)
}
var err error
linkArgs = append(linkArgs, "-o", ea.OutputFile)
linkArgs = append(linkArgs, filesToLink...)
success, err = execCmd(ea.LlvmLinkerName, linkArgs, "")
if !success {
LogError("There was an error linking input files into %s because %v.\n", ea.OutputFile, err)
return
}
informUser("Bitcode file extracted to: %s.\n", ea.OutputFile)
success = true
return
}
Expand Down

0 comments on commit 02ea4c5

Please sign in to comment.