Skip to content

Commit 02ea4c5

Browse files
committed
Complaints from the peanut gallery.
1 parent 27ff069 commit 02ea4c5

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

shared/environment.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ func init() {
108108
FetchEnvironment()
109109
}
110110

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

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

124125
}
125126

126-
// also used in testing
127+
// ResetEnvironment resets the globals, it is only used in testing
127128
func ResetEnvironment() {
128129
LLVMToolChainBinDir = ""
129130
LLVMCCName = ""
@@ -139,7 +140,7 @@ func ResetEnvironment() {
139140
LLVMbcGen = []string{}
140141
}
141142

142-
// also used in testing
143+
// FetchEnvironment is used in initializing our globals, it is also used in testing
143144
func FetchEnvironment() {
144145
LLVMToolChainBinDir = os.Getenv(envpath)
145146
LLVMCCName = os.Getenv(envcc)

shared/extractor.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ import (
5050
"strings"
5151
)
5252

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

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

9697
var flagSet *flag.FlagSet = flag.NewFlagSet(args[0], flag.ContinueOnError)
@@ -656,17 +657,16 @@ func linkBitcodeFiles(ea ExtractionArgs, filesToLink []string) (success bool) {
656657
}
657658
if getsize(filesToLink) > argMax { //command line size too large for the OS (necessitated by chromium)
658659
return linkBitcodeFilesIncrementally(ea, filesToLink, argMax, linkArgs)
659-
} else {
660-
var err error
661-
linkArgs = append(linkArgs, "-o", ea.OutputFile)
662-
linkArgs = append(linkArgs, filesToLink...)
663-
success, err = execCmd(ea.LlvmLinkerName, linkArgs, "")
664-
if !success {
665-
LogError("There was an error linking input files into %s because %v.\n", ea.OutputFile, err)
666-
return
667-
}
668-
informUser("Bitcode file extracted to: %s.\n", ea.OutputFile)
669660
}
661+
var err error
662+
linkArgs = append(linkArgs, "-o", ea.OutputFile)
663+
linkArgs = append(linkArgs, filesToLink...)
664+
success, err = execCmd(ea.LlvmLinkerName, linkArgs, "")
665+
if !success {
666+
LogError("There was an error linking input files into %s because %v.\n", ea.OutputFile, err)
667+
return
668+
}
669+
informUser("Bitcode file extracted to: %s.\n", ea.OutputFile)
670670
success = true
671671
return
672672
}

0 commit comments

Comments
 (0)