diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2018-08-08 16:33:22 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2018-08-08 16:33:22 +0000 |
commit | caacedb03e95fb02cad30b0d53eb52494a543674 (patch) | |
tree | 23a0892bcfbb98265a3633c733d7911d6f68effb | |
parent | fe839695a8b9986da53f5587e901aca0a4e46c90 (diff) | |
download | bcm5719-llvm-caacedb03e95fb02cad30b0d53eb52494a543674.tar.gz bcm5719-llvm-caacedb03e95fb02cad30b0d53eb52494a543674.zip |
[DebugInfo] Fine tune emitting flags as part of the producer
When using APPLE extensions, don't duplicate the compiler invocation's
flags both in AT_producer and AT_APPLE_flags.
Differential revision: https://reviews.llvm.org/D50453
llvm-svn: 339268
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 2 | ||||
-rw-r--r-- | llvm/test/DebugInfo/X86/debug-info-producer-with-flags.ll | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 388fe8a822f..6ee1de0dba3 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -544,7 +544,7 @@ DwarfDebug::getOrCreateDwarfCompileUnit(const DICompileUnit *DIUnit) { StringRef Producer = DIUnit->getProducer(); StringRef Flags = DIUnit->getFlags(); - if (!Flags.empty()) { + if (!Flags.empty() && !useAppleExtensionAttributes()) { std::string ProducerWithFlags = Producer.str() + " " + Flags.str(); NewCU.addString(Die, dwarf::DW_AT_producer, ProducerWithFlags); } else diff --git a/llvm/test/DebugInfo/X86/debug-info-producer-with-flags.ll b/llvm/test/DebugInfo/X86/debug-info-producer-with-flags.ll index 5672671b3d2..d055cc6a2f3 100644 --- a/llvm/test/DebugInfo/X86/debug-info-producer-with-flags.ll +++ b/llvm/test/DebugInfo/X86/debug-info-producer-with-flags.ll @@ -1,5 +1,7 @@ ; RUN: llc -mtriple=x86_64-unknown-linux-gnu %s -o %t -filetype=obj -; RUN: llvm-dwarfdump -debug-info %t | FileCheck %s +; RUN: llvm-dwarfdump -debug-info %t | FileCheck %s --check-prefix LINUX +; RUN: llc -mtriple=x86_64-apple-macosx %s -o %t -filetype=obj +; RUN: llvm-dwarfdump -debug-info %t | FileCheck %s --check-prefix DARWIN ; ; Test the DW_AT_producer DWARF attribute. ; When producer and flags are both given in DIComileUnit, set DW_AT_producer @@ -16,8 +18,10 @@ ; return 0; ; } -; CHECK: DW_AT_producer -; CHECK-SAME: "clang++ -g -grecord-gcc-switches test.cc -S -emit-llvm -o -" +; LINUX: DW_AT_producer{{.*}}("clang++ -g -grecord-gcc-switches test.cc -S -emit-llvm -o -") +; DARWIN: DW_AT_producer{{.*}}("clang++") +; DARWIN: DW_AT_APPLE_flags{{.*}}("-g -grecord-gcc-switches test.cc -S -emit-llvm -o -") + target triple = "x86_64-unknown-linux-gnu" define i32 @main() !dbg !6 { |