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
diff --git a/cc/config/global.go b/cc/config/global.go
index e450ba7..d6f8d62 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -48,7 +48,6 @@
"-Wno-multichar",
"-O2",
- "-g",
"-fdebug-default-version=5",
"-fno-strict-aliasing",
@@ -374,6 +373,21 @@
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, " ")
})