Skip to content

Commit 7b124c0

Browse files
committed
[Driver] Set the default win32-macho debug format to DWARF
rdar://53267670 Differential Revision: https://reviews.llvm.org/D65116 llvm-svn: 366744
1 parent 827427f commit 7b124c0

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

clang/lib/Driver/ToolChains/MSVC.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,12 @@ class LLVM_LIBRARY_VISIBILITY MSVCToolChain : public ToolChain {
7878
bool isPIEDefault() const override;
7979
bool isPICDefaultForced() const override;
8080

81-
/// Set CodeView as the default debug info format. Users can use -gcodeview
82-
/// and -gdwarf to override the default.
81+
/// Set CodeView as the default debug info format for non-MachO binary
82+
/// formats, and to DWARF otherwise. Users can use -gcodeview and -gdwarf to
83+
/// override the default.
8384
codegenoptions::DebugInfoFormat getDefaultDebugFormat() const override {
84-
return codegenoptions::DIF_CodeView;
85+
return getTriple().isOSBinFormatMachO() ? codegenoptions::DIF_DWARF
86+
: codegenoptions::DIF_CodeView;
8587
}
8688

8789
/// Set the debugger tuning to "default", since we're definitely not tuning

clang/test/Misc/win32-macho.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
// Check that basic use of win32-macho targets works.
22
// RUN: %clang -fsyntax-only -target x86_64-pc-win32-macho %s
3+
4+
// RUN: %clang -fsyntax-only -target x86_64-pc-win32-macho -g %s -### 2>&1 | FileCheck %s -check-prefix=DEBUG-INFO
5+
// DEBUG-INFO: -dwarf-version={{.*}}

0 commit comments

Comments
 (0)