r366744 - [Driver] Set the default win32-macho debug format to DWARF

Vedant Kumar via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 22 14:46:45 PDT 2019


Author: vedantk
Date: Mon Jul 22 14:46:45 2019
New Revision: 366744

URL: http://llvm.org/viewvc/llvm-project?rev=366744&view=rev
Log:
[Driver] Set the default win32-macho debug format to DWARF

rdar://53267670

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

Modified:
    cfe/trunk/lib/Driver/ToolChains/MSVC.h
    cfe/trunk/test/Misc/win32-macho.c

Modified: cfe/trunk/lib/Driver/ToolChains/MSVC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MSVC.h?rev=366744&r1=366743&r2=366744&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/MSVC.h (original)
+++ cfe/trunk/lib/Driver/ToolChains/MSVC.h Mon Jul 22 14:46:45 2019
@@ -78,10 +78,12 @@ public:
   bool isPIEDefault() const override;
   bool isPICDefaultForced() const override;
 
-  /// Set CodeView as the default debug info format. Users can use -gcodeview
-  /// and -gdwarf to override the default.
+  /// Set CodeView as the default debug info format for non-MachO binary
+  /// formats, and to DWARF otherwise. Users can use -gcodeview and -gdwarf to
+  /// override the default.
   codegenoptions::DebugInfoFormat getDefaultDebugFormat() const override {
-    return codegenoptions::DIF_CodeView;
+    return getTriple().isOSBinFormatMachO() ? codegenoptions::DIF_DWARF
+                                            : codegenoptions::DIF_CodeView;
   }
 
   /// Set the debugger tuning to "default", since we're definitely not tuning

Modified: cfe/trunk/test/Misc/win32-macho.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/win32-macho.c?rev=366744&r1=366743&r2=366744&view=diff
==============================================================================
--- cfe/trunk/test/Misc/win32-macho.c (original)
+++ cfe/trunk/test/Misc/win32-macho.c Mon Jul 22 14:46:45 2019
@@ -1,2 +1,5 @@
 // Check that basic use of win32-macho targets works.
 // RUN: %clang -fsyntax-only -target x86_64-pc-win32-macho %s
+
+// RUN: %clang -fsyntax-only -target x86_64-pc-win32-macho -g %s -### 2>&1 | FileCheck %s -check-prefix=DEBUG-INFO
+// DEBUG-INFO: -dwarf-version={{.*}}




More information about the cfe-commits mailing list