[PATCH] D92958: [gn build] Add gn arg to only emit line numbers for debug info

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 16 13:07:20 PST 2020


aeubanks updated this revision to Diff 312290.
aeubanks added a comment.

add a new symbol_level and use that instead


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92958/new/

https://reviews.llvm.org/D92958

Files:
  llvm/utils/gn/build/BUILD.gn
  llvm/utils/gn/build/buildflags.gni


Index: llvm/utils/gn/build/buildflags.gni
===================================================================
--- llvm/utils/gn/build/buildflags.gni
+++ llvm/utils/gn/build/buildflags.gni
@@ -28,4 +28,11 @@
 declare_args() {
   # Whether to build with optimizations.
   is_optimized = !is_debug
+
+  # Debug info symbol level.
+  if (is_debug) {
+    symbol_level = 2
+  } else {
+    symbol_level = 0
+  }
 }
Index: llvm/utils/gn/build/BUILD.gn
===================================================================
--- llvm/utils/gn/build/BUILD.gn
+++ llvm/utils/gn/build/BUILD.gn
@@ -72,9 +72,13 @@
     ldflags += [ "-mmacosx-version-min=10.10" ]
   }
 
+  assert(symbol_level == 0 || symbol_level == 1 || symbol_level == 2,
+         "Unexpected symbol_level")
   if (host_os != "win") {
-    if (is_debug) {
+    if (symbol_level == 2) {
       cflags += [ "-g" ]
+    } else if (symbol_level == 1) {
+      cflags += [ "-g1" ]
     }
     if (is_optimized) {
       cflags += [ "-O3" ]
@@ -88,11 +92,13 @@
       "-fvisibility-inlines-hidden",
     ]
   } else {
-    if (is_debug) {
-      cflags += [
-        "/Zi",
-        "/FS",
-      ]
+    if (symbol_level != 0) {
+      if (symbol_level == 2) {
+        cflags += [ "/Zi" ]
+      } else if (symbol_level == 1) {
+        cflags += [ "/Zd" ]
+      }
+      cflags += [ "/FS" ]
       ldflags += [ "/DEBUG" ]
 
       # Speed up links with ghash on windows.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92958.312290.patch
Type: text/x-patch
Size: 1423 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201216/2cb1dd4d/attachment.bin>


More information about the llvm-commits mailing list