Use the target triple from the target machine rather than the module
authorEric Christopher <echristo@gmail.com>
Sat, 27 Apr 2013 01:07:52 +0000 (01:07 +0000)
committerEric Christopher <echristo@gmail.com>
Sat, 27 Apr 2013 01:07:52 +0000 (01:07 +0000)
to determine whether or not we're on a darwin platform for debug code
emitting.

Solves the problem of a module with no triple on the command line
and no triple in the module using non-gdb ok features on darwin. Fix
up the member-pointers test to check the correct things for cross
platform (DW_FORM_flag is a good prefix).

Unfortunately no testcase because I have no ideas how to test something
without a triple and without a triple in the module yet check
precisely on two platforms. Ideas welcome.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180660 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/AsmPrinter.h
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/CodeGen/AsmPrinter/DwarfDebug.cpp
test/DebugInfo/member-pointers.ll

index f2b0f9be96146214ef4e25476f9dcd0a94759a19..c2fd6ce3679cc09ede23441f1259293a0fe30574 100644 (file)
@@ -135,6 +135,9 @@ namespace llvm {
     /// getDataLayout - Return information about data layout.
     const DataLayout &getDataLayout() const;
 
+    /// getTargetTriple - Return the target triple string.
+    StringRef getTargetTriple() const;
+
     /// getCurrentSection() - Return the current section we are emitting to.
     const MCSection *getCurrentSection() const;
 
index 864787d32fd28399f2f189956183fd662a264dec..84162ace4188b5d070e995f5498e5d56b5db2a81 100644 (file)
@@ -133,6 +133,10 @@ const DataLayout &AsmPrinter::getDataLayout() const {
   return *TM.getDataLayout();
 }
 
+StringRef AsmPrinter::getTargetTriple() const {
+  return TM.getTargetTriple();
+}
+
 /// getCurrentSection() - Return the current section we are emitting to.
 const MCSection *AsmPrinter::getCurrentSection() const {
   return OutStreamer.getCurrentSection().first;
index c4e77aafabc38f2844907f82c395c8f82b071a30..ee6308c466a6c834fedecdb0a5867e70e81ab96a 100644 (file)
@@ -176,7 +176,7 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
 
   // Turn on accelerator tables and older gdb compatibility
   // for Darwin.
-  bool IsDarwin = Triple(M->getTargetTriple()).isOSDarwin();
+  bool IsDarwin = Triple(A->getTargetTriple()).isOSDarwin();
   if (DarwinGDBCompat == Default) {
     if (IsDarwin)
       IsDarwinGDBCompat = true;
index a78aa629ec611d957cdb438bddef286d1f64fee7..20f4e68e2aa8b6fb0fdac2bfd01ccfd5d8424228 100644 (file)
@@ -7,7 +7,7 @@
 ; CHECK: [[TYPE:.*]]:   DW_TAG_subroutine_type
 ; CHECK: DW_TAG_formal_parameter
 ; CHECK-NEXT: DW_AT_type
-; CHECK-NEXT: DW_AT_artificial [DW_FORM_flag_present]
+; CHECK-NEXT: DW_AT_artificial [DW_FORM_flag
 ; CHECK: DW_TAG_ptr_to_member_type
 ; CHECK-NEXT: DW_AT_type [DW_FORM_ref4]       (cu + {{.*}} => {[[TYPE]]})
 ; IR generated from clang -g with the following source: