Make clang debug level configurable

The -g flag is controllable with CLANG_DEFAULT_DEBUG_LEVEL from -g0 to
-g3. The default remains -g

Test: Build with CLANG_DEFAULT_DEBUG_LEVEL=debug_level_1

Change-Id: I913d3a0cb028484f9496a7e0a2298852f9b699cd
This commit is contained in:
Fabián Cañas
2023-06-30 17:53:06 +00:00
parent c627847e1b
commit bc10544dec

View File

@@ -48,7 +48,6 @@ var (
"-Wno-multichar",
"-O2",
"-g",
"-fdebug-default-version=5",
"-fno-strict-aliasing",
@@ -374,6 +373,21 @@ func init() {
flags = append(flags, "-Wno-error=unknown-warning-option")
}
switch ctx.Config().Getenv("CLANG_DEFAULT_DEBUG_LEVEL") {
case "debug_level_0":
flags = append(flags, "-g0")
case "debug_level_1":
flags = append(flags, "-g1")
case "debug_level_2":
flags = append(flags, "-g2")
case "debug_level_3":
flags = append(flags, "-g3")
case "debug_level_g":
flags = append(flags, "-g")
default:
flags = append(flags, "-g")
}
return strings.Join(flags, " ")
})