diff --git a/llvm/utils/gn/build/BUILD.gn b/llvm/utils/gn/build/BUILD.gn --- a/llvm/utils/gn/build/BUILD.gn +++ b/llvm/utils/gn/build/BUILD.gn @@ -72,9 +72,12 @@ ldflags += [ "-mmacosx-version-min=10.10" ] } + assert(!(is_debug && is_debug_lines), "Cannot specify both is_debug and is_debug_lines") if (host_os != "win") { if (is_debug) { cflags += [ "-g" ] + } else if (is_debug_lines) { + cflags += [ "-g1" ] } if (is_optimized) { cflags += [ "-O3" ] @@ -88,11 +91,15 @@ "-fvisibility-inlines-hidden", ] } else { - if (is_debug) { + if (is_debug || is_debug_lines) { cflags += [ - "/Zi", "/FS", ] + if (is_debug_lines) { + cflags += [ "/Zi" ] + } else if (is_debug_lines) { + cflags += [ "/Zd" ] + } ldflags += [ "/DEBUG" ] # Speed up links with ghash on windows. diff --git a/llvm/utils/gn/build/buildflags.gni b/llvm/utils/gn/build/buildflags.gni --- a/llvm/utils/gn/build/buildflags.gni +++ b/llvm/utils/gn/build/buildflags.gni @@ -2,6 +2,9 @@ # Whether to build with debug information. is_debug = false + # Whether to build with debug information only containing line info. Useful for stack traces. + is_debug_lines = false + # Whether to build with tsan. use_tsan = false