Debug Info: set default to gdwarf-2 for Darwin.
Darwin systems currently do not support dwarf version 3 or above. When we are ready, we can bump the default to gdwarf-4 for Darwin. For other systems, the default is dwarf version 3, if everything goes smoothly, we can bump the version to 4. rdar://13591116 llvm-svn: 185483
This commit is contained in:
parent
9046f94271
commit
38db092083
|
@ -2521,8 +2521,13 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
else if (A->getOption().matches(options::OPT_gdwarf_4))
|
||||
CmdArgs.push_back("-gdwarf-4");
|
||||
else if (!A->getOption().matches(options::OPT_g0) &&
|
||||
!A->getOption().matches(options::OPT_ggdb0))
|
||||
CmdArgs.push_back("-g");
|
||||
!A->getOption().matches(options::OPT_ggdb0)) {
|
||||
// Default is dwarf-2 for darwin.
|
||||
if (getToolChain().getTriple().isOSDarwin())
|
||||
CmdArgs.push_back("-gdwarf-2");
|
||||
else
|
||||
CmdArgs.push_back("-g");
|
||||
}
|
||||
}
|
||||
|
||||
// We ignore flags -gstrict-dwarf and -grecord-gcc-switches for now.
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
// RUN: %clang -target x86_64-linux-gnu -gdwarf-2 -S -emit-llvm -o - %s | FileCheck %s
|
||||
// RUN: %clang -target x86_64-linux-gnu -gdwarf-3 -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER3
|
||||
// RUN: %clang -target x86_64-linux-gnu -gdwarf-4 -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER4
|
||||
// RUN: %clang -target x86_64-linux-gnu -g -S -emit-llvm -o - %s | FileCheck %s --check-prefix=LINUX
|
||||
// RUN: %clang -target x86_64-apple-darwin -g -S -emit-llvm -o - %s | FileCheck %s --check-prefix=DARWIN
|
||||
int main (void) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -8,3 +10,5 @@ int main (void) {
|
|||
// CHECK: metadata !{i32 2, metadata !"Dwarf Version", i32 2}
|
||||
// VER3: metadata !{i32 2, metadata !"Dwarf Version", i32 3}
|
||||
// VER4: metadata !{i32 2, metadata !"Dwarf Version", i32 4}
|
||||
// LINUX: metadata !{i32 2, metadata !"Dwarf Version", i32 3}
|
||||
// DARWIN: metadata !{i32 2, metadata !"Dwarf Version", i32 2}
|
||||
|
|
|
@ -5,5 +5,6 @@
|
|||
// RUN: %clang -### -S %s -g0 -g 2>&1 | FileCheck --check-prefix=CHECK-WITH-G %s
|
||||
|
||||
// CHECK-WITHOUT-G-NOT: "-g"
|
||||
// CHECK-WITH-G: "-g"
|
||||
// Can be -gdwarf.
|
||||
// CHECK-WITH-G: "-g
|
||||
|
||||
|
|
|
@ -26,7 +26,8 @@
|
|||
// RUN: | FileCheck -check-prefix=GIGNORE %s
|
||||
//
|
||||
// G: "-cc1"
|
||||
// G: "-g"
|
||||
// Can be -gdwarf.
|
||||
// G: "-g
|
||||
//
|
||||
// G_D2: "-cc1"
|
||||
// G_D2: "-gdwarf-2"
|
||||
|
@ -41,7 +42,7 @@
|
|||
//
|
||||
// G_ONLY: "-cc1"
|
||||
// G_ONLY-NOT: "-gline-tables-only"
|
||||
// G_ONLY: "-g"
|
||||
// G_ONLY: "-g
|
||||
// G_ONLY-NOT: "-gline-tables-only"
|
||||
//
|
||||
// GLTO_NO: "-cc1"
|
||||
|
|
Loading…
Reference in New Issue