[PATCH] D79173: [Debuginfo][NFC] Avoid double calling of DWARFDie::find(DW_AT_name).

Alexey Lapshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 30 10:08:29 PDT 2020


avl marked an inline comment as done.
avl added inline comments.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFDie.cpp:529-542
 const char *DWARFDie::getName(DINameKind Kind) const {
   if (!isValid() || Kind == DINameKind::None)
     return nullptr;
   // Try to get mangled name only if it was asked for.
   if (Kind == DINameKind::LinkageName) {
-    if (auto Name = dwarf::toString(
-            findRecursively({DW_AT_MIPS_linkage_name, DW_AT_linkage_name}),
----------------
dblaikie wrote:
> Are there any callers left relying on this fallback behavior? Could they be ported to an explicit function dedicated to this task ("getLinkageNameOrShortName") so it's clear?
There are some callers relying on that fallback behavior which could use function with clearer name :

D.getName(DINameKind::LinkageName)    ->  D.getLinkageNameOrShortName()

But there are callers which receive name kind through parameters. In those cases it could not be replaced to getLinkageNameOrShortName:


```
const char *DWARFDie::getSubroutineName(DINameKind Kind) const {
  if (!isSubroutineDIE())
    return nullptr;
  return getName(Kind);
}
...
(Name = DIE.getSubroutineName(Kind)
...
```
I assume that this fallback behavior is important for all who currently specify DINameKind::LinkageName. Probably they could be evaluated and not all would finally require fallback behavior.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79173/new/

https://reviews.llvm.org/D79173





More information about the llvm-commits mailing list