internal/rosa/llvm: LIT args helper
All checks were successful
Test / Create distribution (push) Successful in 1m28s
Test / Sandbox (push) Successful in 4m14s
Test / Hakurei (push) Successful in 7m20s
Test / ShareFS (push) Successful in 7m43s
Test / Sandbox (race detector) (push) Successful in 7m57s
Test / Hakurei (race detector) (push) Successful in 4m55s
Test / Flake checks (push) Successful in 2m23s
All checks were successful
Test / Create distribution (push) Successful in 1m28s
Test / Sandbox (push) Successful in 4m14s
Test / Hakurei (push) Successful in 7m20s
Test / ShareFS (push) Successful in 7m43s
Test / Sandbox (race detector) (push) Successful in 7m57s
Test / Hakurei (race detector) (push) Successful in 4m55s
Test / Flake checks (push) Successful in 2m23s
This is useful for other projects using LIT. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -3,11 +3,33 @@ package rosa
|
|||||||
import (
|
import (
|
||||||
"regexp"
|
"regexp"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"hakurei.app/internal/pkg"
|
"hakurei.app/internal/pkg"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// litArgs returns [LIT] arguments for optional verbosity and check skipping.
|
||||||
|
func litArgs(verbose bool, skipChecks ...string) string {
|
||||||
|
args := []string{"-sv"}
|
||||||
|
if verbose {
|
||||||
|
args[0] = "--verbose"
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(skipChecks) > 0 {
|
||||||
|
skipChecks = slices.Clone(skipChecks)
|
||||||
|
for i, s := range skipChecks {
|
||||||
|
s = regexp.QuoteMeta(s)
|
||||||
|
s = strings.ReplaceAll(s, "/", "\\/")
|
||||||
|
skipChecks[i] = s
|
||||||
|
}
|
||||||
|
args = append(args,
|
||||||
|
"--filter-out='\\''"+strings.Join(skipChecks, "|")+"'\\''")
|
||||||
|
}
|
||||||
|
|
||||||
|
return "'" + strings.Join(args, " ") + "'"
|
||||||
|
}
|
||||||
|
|
||||||
func (t Toolchain) newLLVM() (pkg.Artifact, string) {
|
func (t Toolchain) newLLVM() (pkg.Artifact, string) {
|
||||||
cache := []KV{
|
cache := []KV{
|
||||||
{"ENABLE_LINKER_BUILD_ID", "ON"},
|
{"ENABLE_LINKER_BUILD_ID", "ON"},
|
||||||
@@ -96,11 +118,6 @@ func (t Toolchain) newLLVM() (pkg.Artifact, string) {
|
|||||||
"unwind_leaffunction",
|
"unwind_leaffunction",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
for i, s := range skipChecks {
|
|
||||||
s = regexp.QuoteMeta(s)
|
|
||||||
s = strings.ReplaceAll(s, "/", "\\/")
|
|
||||||
skipChecks[i] = s
|
|
||||||
}
|
|
||||||
|
|
||||||
if presetOpts&OptLLVMNoLTO == 0 {
|
if presetOpts&OptLLVMNoLTO == 0 {
|
||||||
cache = append(cache, []KV{
|
cache = append(cache, []KV{
|
||||||
@@ -113,10 +130,7 @@ func (t Toolchain) newLLVM() (pkg.Artifact, string) {
|
|||||||
// symbols: clock_gettime, mallopt
|
// symbols: clock_gettime, mallopt
|
||||||
{"COMPILER_RT_INCLUDE_TESTS", "OFF"},
|
{"COMPILER_RT_INCLUDE_TESTS", "OFF"},
|
||||||
|
|
||||||
{"LLVM_LIT_ARGS", "'" + strings.Join([]string{
|
{"LLVM_LIT_ARGS", litArgs(true, skipChecks...)},
|
||||||
"--verbose",
|
|
||||||
"--filter-out='\\''" + strings.Join(skipChecks, "|") + "'\\''",
|
|
||||||
}, " ") + "'"},
|
|
||||||
}...)
|
}...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user