[all-commits] [llvm/llvm-project] 26a136: [lldb] Fix dynamic type resolution for types parse...

Pavel Labath via All-commits all-commits at lists.llvm.org
Fri May 2 05:20:35 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 26a1366380796f95f308faab5010b019c4b75b10
      https://github.com/llvm/llvm-project/commit/26a1366380796f95f308faab5010b019c4b75b10
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2025-05-02 (Fri, 02 May 2025)

  Changed paths:
    M lldb/source/Plugins/ExpressionParser/Clang/ClangASTMetadata.cpp
    M lldb/source/Plugins/ExpressionParser/Clang/ClangASTMetadata.h
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
    M lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
    M lldb/test/API/lang/cpp/dynamic-value/Makefile
    M lldb/test/API/lang/cpp/dynamic-value/TestDynamicValue.py
    M lldb/test/API/lang/cpp/dynamic-value/a.h
    A lldb/test/API/lang/cpp/dynamic-value/forward-a.cpp
    M lldb/test/API/lang/cpp/dynamic-value/pass-to-base.cpp

  Log Message:
  -----------
  [lldb] Fix dynamic type resolution for types parsed from declarations (#137974)

This fixes a regression caused by us starting to parse types from
declarations. The code in TypeSystemClang was assuming that the value
held in ClangASTMetadata was authoritative, but this isn't (and cannot)
be the case when the type is parsed from a forward-declaration.

For the fix, I add a new "don't know" state to ClangASTMetadata, and
make sure DWARFASTParserClang sets it only when it encounters a forward
declaration. In this case, the type system will fall back to completing
the type.

This does mean that we will be completing more types than before, but
I'm hoping this will offset by the fact that we don't search for
definition DIEs eagerly. In particular, I don't expect it to make a
difference in -fstandalone-debug scenarios, since types will nearly
always be present as definitions.

To avoid this cost, we'd need to create some sort of a back channel to
query the DWARFASTParser about the dynamicness of the type without
actually completing it. I'd like to avoid that if it is not necessary.



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