[all-commits] [llvm/llvm-project] 02c1c9: [LLDB] Fix printing a static bool struct member wh...

David Spickett via All-commits all-commits at lists.llvm.org
Fri Oct 7 02:03:16 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 02c1c939486f247dc80866477eaab193c634d1e2
      https://github.com/llvm/llvm-project/commit/02c1c939486f247dc80866477eaab193c634d1e2
  Author: David Spickett <david.spickett at linaro.org>
  Date:   2022-10-07 (Fri, 07 Oct 2022)

  Changed paths:
    M lldb/include/lldb/Symbol/CompilerType.h
    M lldb/include/lldb/Symbol/TypeSystem.h
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
    M lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
    M lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
    M lldb/source/Symbol/CompilerType.cpp
    M lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
    M lldb/test/API/lang/cpp/const_static_integral_member/main.cpp

  Log Message:
  -----------
  [LLDB] Fix printing a static bool struct member when using "image lookup -t"

Fixes #58135

Somehow lldb was able to print the member on its own but when we try
to print the whole type found by "image lookup -t" lldb would crash.

This is because we'd encoded the initial value of the member as an integer.
Which isn't the end of the world because bool is integral for C++.
However, clang has a special AST node to handle literal bool and it
expected us to use that instead.

This adds a new codepath to handle static bool which uses cxxBoolLiteralExpr
and we get the member printed as you'd expect.

For testing I added a struct with just the bool because trying to print
all of "A" crashes as well. Presumably because one of the other member's
types isn't handled properly either.

So for now I just added the bool case, we can merge it with A later.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D135169




More information about the All-commits mailing list