[llvm] r339268 - [DebugInfo] Fine tune emitting flags as part of the producer

Jonas Devlieghere via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 8 09:33:22 PDT 2018


Author: jdevlieghere
Date: Wed Aug  8 09:33:22 2018
New Revision: 339268

URL: http://llvm.org/viewvc/llvm-project?rev=339268&view=rev
Log:
[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

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/trunk/test/DebugInfo/X86/debug-info-producer-with-flags.ll

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=339268&r1=339267&r2=339268&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Aug  8 09:33:22 2018
@@ -544,7 +544,7 @@ DwarfDebug::getOrCreateDwarfCompileUnit(
 
   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

Modified: llvm/trunk/test/DebugInfo/X86/debug-info-producer-with-flags.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/debug-info-producer-with-flags.ll?rev=339268&r1=339267&r2=339268&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/debug-info-producer-with-flags.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/debug-info-producer-with-flags.ll Wed Aug  8 09:33:22 2018
@@ -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 {




More information about the llvm-commits mailing list