[all-commits] [llvm/llvm-project] d43811: [lldb/libc++] Simplify the libc++ string formatter

Pavel Labath via All-commits all-commits at lists.llvm.org
Tue Jul 12 00:59:27 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d4381153ea63e9458ffb9dd20ea92fb35d4e3042
      https://github.com/llvm/llvm-project/commit/d4381153ea63e9458ffb9dd20ea92fb35d4e3042
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2022-07-12 (Tue, 12 Jul 2022)

  Changed paths:
    M lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp

  Log Message:
  -----------
  [lldb/libc++] Simplify the libc++ string formatter

Precise string layout has changed a lot recently, but a long of these
changes did not have any effect on the usages of its fields -- e.g.
introduction/removal of an anonymous struct or union does not change the
way one can access the field in C++. Our name-based variable lookup
rules (deliberately) copy the C++ semantics, which means these changes
would have been invisible to the them, if only we were using name-based
lookup.

This patch replaces the opaque child index accesses with name-based
lookups, which allows us to greatly simplify the data formatter code.
The formatter continues to support all the string layouts that it
previously supported.

It is unclear why the formatter was not using this approach from the
beginning. I would speculate that the original version was working
around some (now fixed) issue with anonymous members or base classes,
and the subsequent revisions stuck with that approach out of inertia.

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




More information about the All-commits mailing list