Skip to content

Commit

Permalink
[lldb] Move ValueObject into its own library (NFC) (llvm#113393)
Browse files Browse the repository at this point in the history
ValueObject is part of lldbCore for historical reasons, but conceptually
it deserves to be its own library. This does introduce a (link-time) circular
dependency between lldbCore and lldbValueObject, which is unfortunate
but probably unavoidable because so many things in LLDB rely on
ValueObject. We already have cycles and these libraries are never built
as dylibs so while this doesn't improve the situation, it also doesn't
make things worse.

The header includes were updated with the following command:

```
find . -type f -exec sed -i.bak "s%include \"lldb/Core/ValueObject%include \"lldb/ValueObject/ValueObject%" '{}' \;
```
  • Loading branch information
JDevlieghere authored Oct 25, 2024
1 parent a31ce36 commit b852fb1
Show file tree
Hide file tree
Showing 195 changed files with 413 additions and 380 deletions.
1 change: 0 additions & 1 deletion lldb/include/lldb/Core/IOHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#ifndef LLDB_CORE_IOHANDLER_H
#define LLDB_CORE_IOHANDLER_H

#include "lldb/Core/ValueObjectList.h"
#include "lldb/Host/Config.h"
#include "lldb/Utility/CompletionRequest.h"
#include "lldb/Utility/Flags.h"
Expand Down
2 changes: 1 addition & 1 deletion lldb/include/lldb/DataFormatters/FormattersContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@

#include "lldb/lldb-public.h"

#include "lldb/Core/ValueObject.h"
#include "lldb/DataFormatters/FormatClasses.h"
#include "lldb/DataFormatters/TypeFormat.h"
#include "lldb/DataFormatters/TypeSummary.h"
#include "lldb/DataFormatters/TypeSynthetic.h"
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/StringLexer.h"
#include "lldb/ValueObject/ValueObject.h"

namespace lldb_private {

Expand Down
2 changes: 1 addition & 1 deletion lldb/include/lldb/DataFormatters/TypeFormat.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "lldb/lldb-enumerations.h"
#include "lldb/lldb-public.h"

#include "lldb/Core/ValueObject.h"
#include "lldb/ValueObject/ValueObject.h"

namespace lldb_private {
class TypeFormatImpl {
Expand Down
2 changes: 1 addition & 1 deletion lldb/include/lldb/DataFormatters/TypeSynthetic.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#include "lldb/lldb-enumerations.h"
#include "lldb/lldb-public.h"

#include "lldb/Core/ValueObject.h"
#include "lldb/Utility/StructuredData.h"
#include "lldb/ValueObject/ValueObject.h"

namespace lldb_private {
class SyntheticChildrenFrontEnd {
Expand Down
2 changes: 1 addition & 1 deletion lldb/include/lldb/Expression/ExpressionVariable.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

#include "llvm/ADT/DenseMap.h"

#include "lldb/Core/ValueObject.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/ValueObject/ValueObject.h"
#include "lldb/lldb-public.h"
#include "llvm/Support/ExtensibleRTTI.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#ifndef LLDB_INTERPRETER_OPTIONGROUPVALUEOBJECTDISPLAY_H
#define LLDB_INTERPRETER_OPTIONGROUPVALUEOBJECTDISPLAY_H

#include "lldb/Core/ValueObject.h"
#include "lldb/Interpreter/Options.h"
#include "lldb/ValueObject/ValueObject.h"

namespace lldb_private {

Expand Down
2 changes: 1 addition & 1 deletion lldb/include/lldb/Target/LanguageRuntime.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
#include "lldb/Breakpoint/BreakpointResolverName.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Core/Value.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Expression/LLVMUserExpression.h"
#include "lldb/Symbol/DeclVendor.h"
#include "lldb/Target/ExecutionContextScope.h"
#include "lldb/Target/Runtime.h"
#include "lldb/ValueObject/ValueObject.h"
#include "lldb/lldb-private.h"
#include "lldb/lldb-public.h"
#include <optional>
Expand Down
2 changes: 1 addition & 1 deletion lldb/include/lldb/Target/StackFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
#include "lldb/Utility/Flags.h"

#include "lldb/Core/FormatEntity.h"
#include "lldb/Core/ValueObjectList.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Target/ExecutionContextScope.h"
#include "lldb/Target/StackID.h"
#include "lldb/Utility/Scalar.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/UserID.h"
#include "lldb/ValueObject/ValueObjectList.h"

namespace lldb_private {

Expand Down
4 changes: 2 additions & 2 deletions lldb/include/lldb/Target/StackFrameRecognizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
#ifndef LLDB_TARGET_STACKFRAMERECOGNIZER_H
#define LLDB_TARGET_STACKFRAMERECOGNIZER_H

#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectList.h"
#include "lldb/Symbol/VariableList.h"
#include "lldb/Target/StopInfo.h"
#include "lldb/Utility/StructuredData.h"
#include "lldb/ValueObject/ValueObject.h"
#include "lldb/ValueObject/ValueObjectList.h"
#include "lldb/lldb-private-forward.h"
#include "lldb/lldb-public.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//

#ifndef LLDB_CORE_VALUEOBJECT_H
#define LLDB_CORE_VALUEOBJECT_H
#ifndef LLDB_VALUEOBJECT_VALUEOBJECT_H
#define LLDB_VALUEOBJECT_VALUEOBJECT_H

#include "lldb/Core/Value.h"
#include "lldb/Symbol/CompilerType.h"
Expand Down Expand Up @@ -1004,8 +1004,8 @@ class ValueObject {
} m_flags;

friend class ValueObjectChild;
friend class ExpressionVariable; // For SetName
friend class Target; // For SetName
friend class ExpressionVariable; // For SetName
friend class Target; // For SetName
friend class ValueObjectConstResultImpl;
friend class ValueObjectSynthetic; // For ClearUserVisibleData

Expand Down Expand Up @@ -1079,7 +1079,7 @@ class ValueObject {
void SetPreferredDisplayLanguageIfNeeded(lldb::LanguageType);

protected:
virtual void DoUpdateChildrenAddressType(ValueObject &valobj){};
virtual void DoUpdateChildrenAddressType(ValueObject &valobj) {};

private:
virtual CompilerType MaybeCalculateCompleteType();
Expand All @@ -1100,4 +1100,4 @@ class ValueObject {

} // namespace lldb_private

#endif // LLDB_CORE_VALUEOBJECT_H
#endif // LLDB_VALUEOBJECT_VALUEOBJECT_H
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
//
//===----------------------------------------------------------------------===//

#ifndef LLDB_CORE_VALUEOBJECTCAST_H
#define LLDB_CORE_VALUEOBJECTCAST_H
#ifndef LLDB_VALUEOBJECT_VALUEOBJECTCAST_H
#define LLDB_VALUEOBJECT_VALUEOBJECTCAST_H

#include "lldb/Core/ValueObject.h"
#include "lldb/Symbol/CompilerType.h"
#include "lldb/ValueObject/ValueObject.h"
#include "lldb/lldb-defines.h"
#include "lldb/lldb-enumerations.h"
#include "lldb/lldb-forward.h"
Expand All @@ -27,8 +27,7 @@ class ValueObjectCast : public ValueObject {
public:
~ValueObjectCast() override;

static lldb::ValueObjectSP Create(ValueObject &parent,
ConstString name,
static lldb::ValueObjectSP Create(ValueObject &parent, ConstString name,
const CompilerType &cast_type);

std::optional<uint64_t> GetByteSize() override;
Expand Down Expand Up @@ -64,4 +63,4 @@ class ValueObjectCast : public ValueObject {

} // namespace lldb_private

#endif // LLDB_CORE_VALUEOBJECTCAST_H
#endif // LLDB_VALUEOBJECT_VALUEOBJECTCAST_H
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//

#ifndef LLDB_CORE_VALUEOBJECTCHILD_H
#define LLDB_CORE_VALUEOBJECTCHILD_H
#ifndef LLDB_VALUEOBJECT_VALUEOBJECTCHILD_H
#define LLDB_VALUEOBJECT_VALUEOBJECTCHILD_H

#include "lldb/Core/ValueObject.h"
#include "lldb/ValueObject/ValueObject.h"

#include "lldb/Symbol/CompilerType.h"
#include "lldb/Utility/ConstString.h"
Expand Down Expand Up @@ -76,10 +76,9 @@ class ValueObjectChild : public ValueObject {
friend class ValueObjectVTable;

ValueObjectChild(ValueObject &parent, const CompilerType &compiler_type,
ConstString name, uint64_t byte_size,
int32_t byte_offset, uint32_t bitfield_bit_size,
uint32_t bitfield_bit_offset, bool is_base_class,
bool is_deref_of_parent,
ConstString name, uint64_t byte_size, int32_t byte_offset,
uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
bool is_base_class, bool is_deref_of_parent,
AddressType child_ptr_or_ref_addr_type,
uint64_t language_flags);

Expand All @@ -89,4 +88,4 @@ class ValueObjectChild : public ValueObject {

} // namespace lldb_private

#endif // LLDB_CORE_VALUEOBJECTCHILD_H
#endif // LLDB_VALUEOBJECT_VALUEOBJECTCHILD_H
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
//
//===----------------------------------------------------------------------===//

#ifndef LLDB_CORE_VALUEOBJECTCONSTRESULT_H
#define LLDB_CORE_VALUEOBJECTCONSTRESULT_H
#ifndef LLDB_VALUEOBJECT_VALUEOBJECTCONSTRESULT_H
#define LLDB_VALUEOBJECT_VALUEOBJECTCONSTRESULT_H

#include "lldb/Core/Value.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectConstResultImpl.h"
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/Status.h"
#include "lldb/ValueObject/ValueObject.h"
#include "lldb/ValueObject/ValueObjectConstResultImpl.h"
#include "lldb/lldb-defines.h"
#include "lldb/lldb-enumerations.h"
#include "lldb/lldb-forward.h"
Expand Down Expand Up @@ -50,10 +50,11 @@ class ValueObjectConstResult : public ValueObject {
lldb::ByteOrder byte_order, uint32_t addr_size,
lldb::addr_t address = LLDB_INVALID_ADDRESS);

static lldb::ValueObjectSP
Create(ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
ConstString name, lldb::addr_t address,
AddressType address_type, uint32_t addr_byte_size);
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
const CompilerType &compiler_type,
ConstString name, lldb::addr_t address,
AddressType address_type,
uint32_t addr_byte_size);

static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
Value &value, ConstString name,
Expand Down Expand Up @@ -162,4 +163,4 @@ class ValueObjectConstResult : public ValueObject {

} // namespace lldb_private

#endif // LLDB_CORE_VALUEOBJECTCONSTRESULT_H
#endif // LLDB_VALUEOBJECT_VALUEOBJECTCONSTRESULT_H
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
//
//===----------------------------------------------------------------------===//

#ifndef LLDB_CORE_VALUEOBJECTCONSTRESULTCAST_H
#define LLDB_CORE_VALUEOBJECTCONSTRESULTCAST_H
#ifndef LLDB_VALUEOBJECT_VALUEOBJECTCONSTRESULTCAST_H
#define LLDB_VALUEOBJECT_VALUEOBJECTCONSTRESULTCAST_H

#include "lldb/Core/ValueObjectCast.h"
#include "lldb/Core/ValueObjectConstResultImpl.h"
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/ValueObject/ValueObjectCast.h"
#include "lldb/ValueObject/ValueObjectConstResultImpl.h"
#include "lldb/lldb-defines.h"
#include "lldb/lldb-forward.h"
#include "lldb/lldb-types.h"
Expand Down Expand Up @@ -72,4 +72,4 @@ class ValueObjectConstResultCast : public ValueObjectCast {

} // namespace lldb_private

#endif // LLDB_CORE_VALUEOBJECTCONSTRESULTCAST_H
#endif // LLDB_VALUEOBJECT_VALUEOBJECTCONSTRESULTCAST_H
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
//
//===----------------------------------------------------------------------===//

#ifndef LLDB_CORE_VALUEOBJECTCONSTRESULTCHILD_H
#define LLDB_CORE_VALUEOBJECTCONSTRESULTCHILD_H
#ifndef LLDB_VALUEOBJECT_VALUEOBJECTCONSTRESULTCHILD_H
#define LLDB_VALUEOBJECT_VALUEOBJECTCONSTRESULTCHILD_H

#include "lldb/Core/ValueObjectChild.h"
#include "lldb/Core/ValueObjectConstResultImpl.h"
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/ValueObject/ValueObjectChild.h"
#include "lldb/ValueObject/ValueObjectConstResultImpl.h"
#include "lldb/lldb-defines.h"
#include "lldb/lldb-forward.h"
#include "lldb/lldb-types.h"
Expand All @@ -28,14 +28,11 @@ class ValueObject;
// A child of a ValueObjectConstResult.
class ValueObjectConstResultChild : public ValueObjectChild {
public:
ValueObjectConstResultChild(ValueObject &parent,
const CompilerType &compiler_type,
ConstString name, uint32_t byte_size,
int32_t byte_offset, uint32_t bitfield_bit_size,
uint32_t bitfield_bit_offset, bool is_base_class,
bool is_deref_of_parent,
lldb::addr_t live_address,
uint64_t language_flags);
ValueObjectConstResultChild(
ValueObject &parent, const CompilerType &compiler_type, ConstString name,
uint32_t byte_size, int32_t byte_offset, uint32_t bitfield_bit_size,
uint32_t bitfield_bit_offset, bool is_base_class, bool is_deref_of_parent,
lldb::addr_t live_address, uint64_t language_flags);

~ValueObjectConstResultChild() override;

Expand Down Expand Up @@ -81,4 +78,4 @@ class ValueObjectConstResultChild : public ValueObjectChild {

} // namespace lldb_private

#endif // LLDB_CORE_VALUEOBJECTCONSTRESULTCHILD_H
#endif // LLDB_VALUEOBJECT_VALUEOBJECTCONSTRESULTCHILD_H
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//

#ifndef LLDB_CORE_VALUEOBJECTCONSTRESULTIMPL_H
#define LLDB_CORE_VALUEOBJECTCONSTRESULTIMPL_H
#ifndef LLDB_VALUEOBJECT_VALUEOBJECTCONSTRESULTIMPL_H
#define LLDB_VALUEOBJECT_VALUEOBJECTCONSTRESULTIMPL_H

#include "lldb/Utility/ConstString.h"
#include "lldb/lldb-defines.h"
Expand All @@ -22,7 +22,7 @@ class CompilerType;
class DataExtractor;
class Status;
class ValueObject;
}
} // namespace lldb_private

namespace lldb_private {

Expand Down Expand Up @@ -77,4 +77,4 @@ class ValueObjectConstResultImpl {

} // namespace lldb_private

#endif // LLDB_CORE_VALUEOBJECTCONSTRESULTIMPL_H
#endif // LLDB_VALUEOBJECT_VALUEOBJECTCONSTRESULTIMPL_H
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
//
//===----------------------------------------------------------------------===//

#ifndef LLDB_CORE_VALUEOBJECTDYNAMICVALUE_H
#define LLDB_CORE_VALUEOBJECTDYNAMICVALUE_H
#ifndef LLDB_VALUEOBJECT_VALUEOBJECTDYNAMICVALUE_H
#define LLDB_VALUEOBJECT_VALUEOBJECTDYNAMICVALUE_H

#include "lldb/Core/Address.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Symbol/Type.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/ValueObject/ValueObject.h"
#include "lldb/lldb-defines.h"
#include "lldb/lldb-enumerations.h"
#include "lldb/lldb-forward.h"
Expand Down Expand Up @@ -126,4 +126,4 @@ class ValueObjectDynamicValue : public ValueObject {

} // namespace lldb_private

#endif // LLDB_CORE_VALUEOBJECTDYNAMICVALUE_H
#endif // LLDB_VALUEOBJECT_VALUEOBJECTDYNAMICVALUE_H
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//

#ifndef LLDB_CORE_VALUEOBJECTLIST_H
#define LLDB_CORE_VALUEOBJECTLIST_H
#ifndef LLDB_VALUEOBJECT_VALUEOBJECTLIST_H
#define LLDB_VALUEOBJECT_VALUEOBJECTLIST_H

#include "lldb/lldb-forward.h"
#include "lldb/lldb-types.h"
Expand Down Expand Up @@ -51,6 +51,7 @@ class ValueObjectList {
const std::vector<lldb::ValueObjectSP> &GetObjects() const {
return m_value_objects;
}

protected:
typedef std::vector<lldb::ValueObjectSP> collection;
// Classes that inherit from ValueObjectList can see and modify these
Expand All @@ -59,4 +60,4 @@ class ValueObjectList {

} // namespace lldb_private

#endif // LLDB_CORE_VALUEOBJECTLIST_H
#endif // LLDB_VALUEOBJECT_VALUEOBJECTLIST_H
Loading

0 comments on commit b852fb1

Please sign in to comment.