<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/112947>112947</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            `.debug_names` should index the DIE that has a parent chain
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          dcci
      </td>
    </tr>
</table>

<pre>
    ```
#include <iostream>
namespace google {
class LogMessageVoidify {
 public:
  LogMessageVoidify() { }
 // This has to be an operator with a precedence lower than << but
  // higher than ?:
  void operator&(std::ostream&) { }
};
#define LOG(level) \
    !(level) ? (void) 0 : google::LogMessageVoidify() & std::cerr
#define INFO 1
#define DEBUG 0
}

int main() {
 LOG(INFO) << "This is an informational message." << std::endl;
  return 0;
}
```

Compile with
```
clang++ -std=c++17 -pthread -glldb -gdwarf-5 -fno-debug-types-section -gpubnames patatino.cpp -fuse-ld=lld -o pat
```

`llvm-dwarfdump` shows two duplicate entries, one with parent namespace, the other without.
In the debug_names mapping the entry that gets indexed is the one without parent namespace. We believe the entry with parent namespace should be indexed/should have precedence, if possible, so that lldb can walk back the parent chain and perform faster lookups 

(note: we've been seeing on large projects lldb taking 3 minutes to print an expression using the expression evaluator due to this lack of filtering).

Thoughts on this? @JDevlieghere / @adrian-prantl / @dwblaikie 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8VU1v4zYT_jX0ZSBDomTLOviQxOvFvti3e9m2x4ISRxIbihT4YW_-fTGUYifZbYHAEWeG8zzzSeG9Ggzike0e2e60ETGM1h1l16lNa-XLke3z9S8_sfyB8VKZTkeJwMonZX1wKCZWflrURkzoZ9EhDNYOGoHVj4um08J7-GqH_6P3YsA_rJKqf7kbwBxbrTpWPqznn40ZPzDe0BVg9Wk1Y_zM-Bm-j8rDKDwECy2CMGBndCJYB1cVRhAwO-xQoukQtL2igz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