Skip to content
This repository was archived by the owner on May 21, 2019. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0a19a1b

Browse files
author
Greg Clayton
committedFeb 4, 2012
Convert all python objects in our API to use overload the __str__ method
instead of the __repr__. __repr__ is a function that should return an expression that can be used to recreate an python object and we were using it to just return a human readable string. Fixed a crasher when using the new implementation of SBValue::Cast(SBType). Thread hardened lldb::SBValue and lldb::SBWatchpoint and did other general improvements to the API. Fixed a crasher in lldb::SBValue::GetChildMemberWithName() where we didn't correctly handle not having a target. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149743 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 71d249d commit 0a19a1b

26 files changed

+701
-577
lines changed
 

‎include/lldb/API/SBType.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ class SBType
167167
const lldb_private::TypeImpl &
168168
ref () const;
169169

170+
lldb::TypeImplSP
171+
GetSP ();
172+
170173
void
171174
SetSP (const lldb::TypeImplSP &type_impl_sp);
172175
#endif

‎include/lldb/API/SBValue.h

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -355,27 +355,13 @@ class SBValue
355355
friend class SBValueList;
356356
friend class SBFrame;
357357

358-
#ifndef SWIG
359-
// Mimic shared pointer...
360-
lldb_private::ValueObject *
361-
get() const;
362-
363-
lldb_private::ValueObject *
364-
operator->() const;
365-
366-
lldb::ValueObjectSP &
367-
operator*();
368-
369-
const lldb::ValueObjectSP &
370-
operator*() const;
371-
372-
#endif
373-
358+
lldb::ValueObjectSP
359+
GetSP () const;
360+
361+
void
362+
SetSP (const lldb::ValueObjectSP &sp);
363+
374364
private:
375-
// Helper function for SBValue::Watch() and SBValue::WatchPointee().
376-
lldb::SBWatchpoint
377-
WatchValue(bool read, bool write, bool watch_pointee);
378-
379365
lldb::ValueObjectSP m_opaque_sp;
380366
};
381367

‎include/lldb/API/SBWatchpoint.h

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ class SBWatchpoint
2222

2323
SBWatchpoint (const lldb::SBWatchpoint &rhs);
2424

25+
SBWatchpoint (const lldb::WatchpointSP &wp_sp);
26+
2527
~SBWatchpoint ();
2628

27-
#ifndef SWIG
2829
const lldb::SBWatchpoint &
2930
operator = (const lldb::SBWatchpoint &rhs);
30-
#endif
3131

3232
bool
3333
IsValid() const;
@@ -72,27 +72,20 @@ class SBWatchpoint
7272
bool
7373
GetDescription (lldb::SBStream &description, DescriptionLevel level);
7474

75-
#ifndef SWIG
76-
SBWatchpoint (const lldb::WatchpointSP &wp_sp);
77-
#endif
75+
void
76+
Clear ();
77+
78+
lldb::WatchpointSP
79+
GetSP () const;
80+
81+
void
82+
SetSP (const lldb::WatchpointSP &sp);
7883

7984
private:
8085
friend class SBTarget;
8186
friend class SBValue;
8287

83-
#ifndef SWIG
84-
85-
lldb_private::Watchpoint *
86-
operator->();
87-
88-
lldb_private::Watchpoint *
89-
get();
90-
91-
lldb::WatchpointSP &
92-
operator *();
93-
94-
#endif
95-
88+
9689
lldb::WatchpointSP m_opaque_sp;
9790

9891
};

‎include/lldb/Core/ValueObject.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,9 @@ class ValueObject : public UserID
518518
virtual ConstString
519519
GetTypeName() = 0;
520520

521+
//------------------------------------------------------------------
522+
// Sublasses can implement the functions below.
523+
//------------------------------------------------------------------
521524
virtual lldb::LanguageType
522525
GetObjectRuntimeLanguage();
523526

@@ -632,6 +635,10 @@ class ValueObject : public UserID
632635
return m_parent->GetModule();
633636
return NULL;
634637
}
638+
639+
virtual bool
640+
GetDeclaration (Declaration &decl);
641+
635642
//------------------------------------------------------------------
636643
// The functions below should NOT be modified by sublasses
637644
//------------------------------------------------------------------

‎include/lldb/Core/ValueObjectDynamicValue.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ namespace lldb_private {
2222
class ValueObjectCast : public ValueObject
2323
{
2424
public:
25+
static lldb::ValueObjectSP
26+
Create (ValueObject &parent,
27+
const ConstString &name,
28+
const ClangASTType &cast_type);
29+
2530
virtual
2631
~ValueObjectCast();
2732

@@ -83,7 +88,6 @@ namespace lldb_private {
8388
ClangASTType m_cast_type;
8489

8590
private:
86-
friend class ValueObject;
8791
ValueObjectCast (ValueObject &parent,
8892
const ConstString &name,
8993
const ClangASTType &cast_type);

‎include/lldb/Core/ValueObjectVariable.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ class ValueObjectVariable : public ValueObject
5858
virtual SymbolContextScope *
5959
GetSymbolContextScope();
6060

61+
virtual bool
62+
GetDeclaration (Declaration &decl);
63+
6164
protected:
6265
virtual bool
6366
UpdateValue ();

‎include/lldb/Symbol/ClangASTType.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ class ClangASTType
301301
uint32_t& stride);
302302

303303
lldb::clang_type_t
304-
GetPointerType ();
304+
GetPointerType () const;
305305

306306
static lldb::clang_type_t
307307
GetPointerType (clang::ASTContext *ast_context,

0 commit comments

Comments
 (0)