aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2018-04-09 14:38:53 +0000
committerPavel Labath <labath@google.com>2018-04-09 14:38:53 +0000
commiteadfac87480b76f2069e41da9b92fe9f745fac8a (patch)
treed8b10e583630f313942e9185271305ccaba73e35 /llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp
parentc1d6b5e458ed8d9f21b5548ef10c96dbdab9f476 (diff)
downloadllvm-eadfac87480b76f2069e41da9b92fe9f745fac8a.zip
llvm-eadfac87480b76f2069e41da9b92fe9f745fac8a.tar.gz
llvm-eadfac87480b76f2069e41da9b92fe9f745fac8a.tar.bz2
[CodeGen/AccelTable] Don't emit zero-CU name indexes
Summary: If an input DICompileUnit is completely empty (e.g., the result of running "clang -g" on an empty file), we don't bother emitting an empty DWARF CU. When we do that, we must make sure we don't also emit a DWARF v5 name index, as DWARF specifies that each index must reference at least one compilation unit. Reviewers: JDevlieghere, aprantl, dblaikie Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D45435 llvm-svn: 329575
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp b/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp
index d6cfbdb..1107e02 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp
@@ -356,6 +356,8 @@ void AppleAccelTableEmitter::emit() const {
void Dwarf5AccelTableEmitter::Header::emit(
const Dwarf5AccelTableEmitter &Ctx) const {
+ assert(CompUnitCount > 0 && "Index must have at least one CU.");
+
AsmPrinter *Asm = Ctx.Asm;
Asm->OutStreamer->AddComment("Header: unit length");
Asm->EmitLabelDifference(Ctx.ContributionEnd, Ctx.ContributionStart,