From: Vedant Kumar Date: Mon, 22 Jul 2019 21:46:45 +0000 (+0000) Subject: [Driver] Set the default win32-macho debug format to DWARF X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4d2a674f7751064fe2d64b1d848194fac3314c79;p=clang [Driver] Set the default win32-macho debug format to DWARF 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 --- diff --git a/lib/Driver/ToolChains/MSVC.h b/lib/Driver/ToolChains/MSVC.h index aba9417c97..a8ef481556 100644 --- a/lib/Driver/ToolChains/MSVC.h +++ b/lib/Driver/ToolChains/MSVC.h @@ -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 diff --git a/test/Misc/win32-macho.c b/test/Misc/win32-macho.c index 517bde9af9..1eab5381bf 100644 --- a/test/Misc/win32-macho.c +++ b/test/Misc/win32-macho.c @@ -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={{.*}}