[all-commits] [llvm/llvm-project] c660b2: [lldb][SymbolFileDWARF] Ignore Declaration when se...

Michael Buch via All-commits all-commits at lists.llvm.org
Mon Dec 23 03:52:13 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c660b281b60085cbe40d73d692badd43d7708d20
      https://github.com/llvm/llvm-project/commit/c660b281b60085cbe40d73d692badd43d7708d20
  Author: Michael Buch <michaelbuch12 at gmail.com>
  Date:   2024-12-23 (Mon, 23 Dec 2024)

  Changed paths:
    M lldb/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp
    M lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp

  Log Message:
  -----------
  [lldb][SymbolFileDWARF] Ignore Declaration when searching through UniqueDWARFASTTypeList in C++ (#120809)

This addresses an issue encountered when investigating
https://github.com/llvm/llvm-project/pull/120569.

In `ParseTypeFromDWARF`, we insert the parsed type into
`UniqueDWARFASTTypeMap` using the typename and `Declaration` obtained
with `GetUniqueTypeNameAndDeclaration`. For C++
`GetUniqueTypeNameAndDeclaration` will zero the `Declaration` info
(presumably because forward declaration may not have it, and for C++,
ODR means we can rely on fully qualified typenames for uniqueing). When
we then called `CompleteType`, we would first `MapDeclDIEToDefDIE`,
updating the `UniqueDWARFASTType` we inserted previously with the
`Declaration` of the definition DIE (without zeroing it). We would then
call into `ParseTypeFromDWARF` for the same type again, and search the
`UniqueDWARFASTTypeMap`. But we do the search using a zeroed declaration
we get from `GetUniqueTypeNameAndDeclaration`.

This particular example was fixed by
https://github.com/llvm/llvm-project/pull/120569 but this still feels a
little inconsistent. I'm not entirely sure we can get into that
situation after that patch anymore. So the only test-case I could come
up with was the unit-test which calls `MapDeclDIEToDefDIE` directly.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list