]> granicus.if.org Git - clang/commit
[Driver] Simplify -g level computation and its interaction with -gsplit-dwarf
authorFangrui Song <maskray@google.com>
Wed, 17 Apr 2019 01:46:27 +0000 (01:46 +0000)
committerFangrui Song <maskray@google.com>
Wed, 17 Apr 2019 01:46:27 +0000 (01:46 +0000)
commit07085cfb0ca4661856c4921a6ac9b5821cfe2475
treee3bec67ca10bfe0f53861472e2ffa6abeb074f61
parent6ee5a19b2cd93e000c891e3c18edf2b20428a1d2
[Driver] Simplify -g level computation and its interaction with -gsplit-dwarf

Summary:
When -gsplit-dwarf is used together with other -g options, in most cases
the computed debug info level is decided by the last -g option, with one
special case (see below). This patch drops that special case and thus
makes it easy to reason about:

// If a lower debug level -g comes after -gsplit-dwarf, in some cases
// -gsplit-dwarf is cancelled.
-gsplit-dwarf -g0 => 0
-gsplit-dwarf -gline-directives-only => DebugDirectivesOnly
-gsplit-dwarf -gmlt -fsplit-dwarf-inlining => 1
-gsplit-dwarf -gmlt -fno-split-dwarf-inlining => 1 + split

// If -gsplit-dwarf comes after -g options, with this patch, the net
// effect is 2 + split for all combinations
-g0 -gsplit-dwarf => 2 + split
-gline-directives-only -gsplit-dwarf => 2 + split
-gmlt -gsplit-dwarf -fsplit-dwarf-inlining => 2 + split
-gmlt -gsplit-dwarf -fno-split-dwarf-inlining => 1 + split (before) 2 + split (after)

The last case has been changed. In general, if the user intends to lower
debug info level, place that -g option after -gsplit-dwarf.

Some context:

In gcc, the last of -gsplit-dwarf -g0 -g1 -g2 -g3 -ggdb[0-3] -gdwarf-*
... decides the debug info level (-gsplit-dwarf -gdwarf-* have level 2).
It is a bit unfortunate that -gsplit-dwarf -gdwarf-* ... participate in
the level computation but that is the status quo.

Reviewers: dblaikie, echristo, probinson

Reviewed By: dblaikie, probinson

Subscribers: probinson, aprantl, jdoerfert, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D59923

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@358544 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Driver/ToolChains/Clang.cpp
test/Driver/split-debug.c