[clang] [llvm] [Clang] Emit DW_TAG_template_alias for template aliases (PR #87623)
Paul T Robinson via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 15 11:58:29 PDT 2024
================
@@ -4584,6 +4584,32 @@ renderDebugOptions(const ToolChain &TC, const Driver &D, const llvm::Triple &T,
}
}
+ // Emit DW_TAG_template_alias for template aliases? True by default for SCE.
+ const auto *DebugTemplateAlias = Args.getLastArg(
+ options::OPT_gtemplate_alias, options::OPT_gno_template_alias);
+ bool UseDebugTemplateAlias =
+ DebuggerTuning == llvm::DebuggerKind::SCE && RequestedDWARFVersion >= 5;
+ if (DebugTemplateAlias &&
+ checkDebugInfoOption(DebugTemplateAlias, Args, D, TC)) {
+ const auto &Opt = DebugTemplateAlias->getOption();
+ UseDebugTemplateAlias = Opt.matches(options::OPT_gtemplate_alias);
+ }
+ if (UseDebugTemplateAlias) {
+ // DW_TAG_template_alias is a DWARFv5 feature. Warn if we can't use it.
+ if (DebugTemplateAlias && RequestedDWARFVersion < 5)
+ D.Diag(diag::warn_drv_dwarf_feature_requires_version)
+ << DebugTemplateAlias->getAsString(Args) << 5
+ << RequestedDWARFVersion;
+ else if (DebugTemplateAlias && EffectiveDWARFVersion < 5)
+ // The toolchain has reduced allowed dwarf version, so we can't enable
+ // -gtemplate-alias.
+ D.Diag(diag::warn_drv_dwarf_version_limited_by_target)
+ << DebugTemplateAlias->getAsString(Args) << TC.getTripleString() << 5
+ << EffectiveDWARFVersion;
+ else
----------------
pogo59 wrote:
```suggestion
else
```
https://github.com/llvm/llvm-project/pull/87623
More information about the cfe-commits
mailing list