Skip to content

Commit 093171b

Browse files
authored
[Clang] Fix template alias default DWARF version (#89594)
DW_TAG_template_alias DIEs were added in DWARFv4, not DWARFv5
1 parent 5b6db43 commit 093171b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4634,7 +4634,7 @@ renderDebugOptions(const ToolChain &TC, const Driver &D, const llvm::Triple &T,
46344634

46354635
// Emit DW_TAG_template_alias for template aliases? True by default for SCE.
46364636
bool UseDebugTemplateAlias =
4637-
DebuggerTuning == llvm::DebuggerKind::SCE && RequestedDWARFVersion >= 5;
4637+
DebuggerTuning == llvm::DebuggerKind::SCE && RequestedDWARFVersion >= 4;
46384638
if (const auto *DebugTemplateAlias = Args.getLastArg(
46394639
options::OPT_gtemplate_alias, options::OPT_gno_template_alias)) {
46404640
// DW_TAG_template_alias is only supported from DWARFv5 but if a user

clang/test/Driver/debug-options.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,9 +456,9 @@
456456
// RUN: %clang -### -target x86_64 -c -g %s 2>&1 | FileCheck --check-prefix=FULL_TEMP_NAMES --implicit-check-not=debug-forward-template-params %s
457457
// FULL_TEMP_NAMES-NOT: -gsimple-template-names
458458

459-
//// Test -g[no-]template-alias (enabled by default with SCE debugger tuning and DWARFv5).
459+
//// Test -g[no-]template-alias (enabled by default with SCE debugger tuning and DWARF version >= 4).
460460
// RUN: %clang -### -target x86_64 -c -gdwarf-5 -gsce %s 2>&1 | FileCheck %s --check-prefixes=TEMPLATE-ALIAS
461-
// RUN: %clang -### -target x86_64 -c -gdwarf-4 -gsce %s 2>&1 | FileCheck %s --check-prefixes=NO-TEMPLATE-ALIAS
461+
// RUN: %clang -### -target x86_64 -c -gdwarf-3 -gsce %s 2>&1 | FileCheck %s --check-prefixes=NO-TEMPLATE-ALIAS
462462
// RUN: %clang -### -target x86_64 -c -gdwarf-5 -gsce -gtemplate-alias %s 2>&1 | FileCheck %s --check-prefixes=TEMPLATE-ALIAS
463463
// RUN: %clang -### -target x86_64 -c -gdwarf-5 -gsce -gno-template-alias %s 2>&1 | FileCheck %s --check-prefixes=NO-TEMPLATE-ALIAS
464464
// RUN: %clang -### -target x86_64 -c -gdwarf-5 -gtemplate-alias %s 2>&1 | FileCheck %s --check-prefixes=TEMPLATE-ALIAS

0 commit comments

Comments
 (0)