[all-commits] [llvm/llvm-project] d77e3c: [lldb][NFC] Don't inherit from UserID in ValueObject

Raphael Isemann via All-commits all-commits at lists.llvm.org
Tue Feb 23 01:16:30 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d77e3c6aec2916fdf7b8ab0ca08c550230244695
      https://github.com/llvm/llvm-project/commit/d77e3c6aec2916fdf7b8ab0ca08c550230244695
  Author: Raphael Isemann <teemperor at gmail.com>
  Date:   2021-02-23 (Tue, 23 Feb 2021)

  Changed paths:
    M lldb/include/lldb/Core/ValueObject.h
    M lldb/source/Core/ValueObject.cpp
    M lldb/source/DataFormatters/TypeSynthetic.cpp

  Log Message:
  -----------
  [lldb][NFC] Don't inherit from UserID in ValueObject

ValueObject inherits from UserID which is just a bad idea:

* The inheritance gives ValueObject some member functions that are at best
  misleading (such as `Clear()` which doesn't clear any value beside `id`).

* It allows passing ValueObject to the overloaded operators for UserID (such as
  `==` or `<<` which won't actually compare or print anything in the ValueObject).

* It exposes the `SetID` and `Clear` which both allow users to change the
  internal id value.

Similar to D91699 which did the same for Process

Reviewed By: #lldb, JDevlieghere

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




More information about the All-commits mailing list