]> granicus.if.org Git - clang/commitdiff
[Driver] Set the default win32-macho debug format to DWARF
authorVedant Kumar <vsk@apple.com>
Mon, 22 Jul 2019 21:46:45 +0000 (21:46 +0000)
committerVedant Kumar <vsk@apple.com>
Mon, 22 Jul 2019 21:46:45 +0000 (21:46 +0000)
rdar://53267670

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

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

lib/Driver/ToolChains/MSVC.h
test/Misc/win32-macho.c

index aba9417c97279388c864b6a8913ae87cf6ea24c2..a8ef4815564065c1ea2861e04a7cc72b8d13363a 100644 (file)
@@ -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
index 517bde9af9365ee67d132444a9a02a9db0cf284d..1eab5381bfaaa22b04b59c45b5e5af7622b08f9b 100644 (file)
@@ -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={{.*}}