[Lldb-commits] [lldb] bda83ba - [lldb][NFC] Clean up ValueObject comments

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 23 03:02:58 PST 2021


Author: Raphael Isemann
Date: 2021-02-23T12:02:36+01:00
New Revision: bda83ba0d296303dff02d262cab73dc984cda3c1

URL: https://github.com/llvm/llvm-project/commit/bda83ba0d296303dff02d262cab73dc984cda3c1
DIFF: https://github.com/llvm/llvm-project/commit/bda83ba0d296303dff02d262cab73dc984cda3c1.diff

LOG: [lldb][NFC] Clean up ValueObject comments

* Remove commented out code.
* Doxygenify comments that serve as documentation.
* Use the LLVM comment style where possible.

Added: 
    

Modified: 
    lldb/include/lldb/Core/ValueObject.h
    lldb/include/lldb/Core/ValueObjectCast.h
    lldb/include/lldb/Core/ValueObjectChild.h
    lldb/include/lldb/Core/ValueObjectConstResult.h
    lldb/include/lldb/Core/ValueObjectConstResultImpl.h
    lldb/include/lldb/Core/ValueObjectDynamicValue.h
    lldb/include/lldb/Core/ValueObjectList.h
    lldb/include/lldb/Core/ValueObjectMemory.h
    lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
    lldb/include/lldb/Core/ValueObjectVariable.h

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Core/ValueObject.h b/lldb/include/lldb/Core/ValueObject.h
index 308e0795efe66..2042baae97ed5 100644
--- a/lldb/include/lldb/Core/ValueObject.h
+++ b/lldb/include/lldb/Core/ValueObject.h
@@ -121,55 +121,62 @@ class ValueObject {
   };
 
   enum ExpressionPathScanEndReason {
-    eExpressionPathScanEndReasonEndOfString = 1,      // out of data to parse
-    eExpressionPathScanEndReasonNoSuchChild,          // child element not found
-    eExpressionPathScanEndReasonNoSuchSyntheticChild, // (synthetic) child
-                                                      // element not found
-    eExpressionPathScanEndReasonEmptyRangeNotAllowed, // [] only allowed for
-                                                      // arrays
-    eExpressionPathScanEndReasonDotInsteadOfArrow, // . used when -> should be
-                                                   // used
-    eExpressionPathScanEndReasonArrowInsteadOfDot, // -> used when . should be
-                                                   // used
-    eExpressionPathScanEndReasonFragileIVarNotAllowed,   // ObjC ivar expansion
-                                                         // not allowed
-    eExpressionPathScanEndReasonRangeOperatorNotAllowed, // [] not allowed by
-                                                         // options
-    eExpressionPathScanEndReasonRangeOperatorInvalid, // [] not valid on objects
-                                                      // other than scalars,
-                                                      // pointers or arrays
-    eExpressionPathScanEndReasonArrayRangeOperatorMet, // [] is good for arrays,
-                                                       // but I cannot parse it
-    eExpressionPathScanEndReasonBitfieldRangeOperatorMet, // [] is good for
-                                                          // bitfields, but I
-                                                          // cannot parse after
-                                                          // it
-    eExpressionPathScanEndReasonUnexpectedSymbol, // something is malformed in
-                                                  // the expression
-    eExpressionPathScanEndReasonTakingAddressFailed,   // impossible to apply &
-                                                       // operator
-    eExpressionPathScanEndReasonDereferencingFailed,   // impossible to apply *
-                                                       // operator
-    eExpressionPathScanEndReasonRangeOperatorExpanded, // [] was expanded into a
-                                                       // VOList
-    eExpressionPathScanEndReasonSyntheticValueMissing, // getting the synthetic
-                                                       // children failed
+    /// Out of data to parse.
+    eExpressionPathScanEndReasonEndOfString = 1,
+    /// Child element not found.
+    eExpressionPathScanEndReasonNoSuchChild,
+    /// (Synthetic) child  element not found.
+    eExpressionPathScanEndReasonNoSuchSyntheticChild,
+    /// [] only allowed for arrays.
+    eExpressionPathScanEndReasonEmptyRangeNotAllowed,
+    /// . used when -> should be used.
+    eExpressionPathScanEndReasonDotInsteadOfArrow,
+    /// -> used when . should be used.
+    eExpressionPathScanEndReasonArrowInsteadOfDot,
+    /// ObjC ivar expansion not allowed.
+    eExpressionPathScanEndReasonFragileIVarNotAllowed,
+    /// [] not allowed by options.
+    eExpressionPathScanEndReasonRangeOperatorNotAllowed,
+    /// [] not valid on objects  other than scalars, pointers or arrays.
+    eExpressionPathScanEndReasonRangeOperatorInvalid,
+    /// [] is good for arrays,  but I cannot parse it.
+    eExpressionPathScanEndReasonArrayRangeOperatorMet,
+    /// [] is good for bitfields, but I cannot parse after it.
+    eExpressionPathScanEndReasonBitfieldRangeOperatorMet,
+    /// Something is malformed in he expression.
+    eExpressionPathScanEndReasonUnexpectedSymbol,
+    /// Impossible to apply &  operator.
+    eExpressionPathScanEndReasonTakingAddressFailed,
+    /// Impossible to apply *  operator.
+    eExpressionPathScanEndReasonDereferencingFailed,
+    /// [] was expanded into a  VOList.
+    eExpressionPathScanEndReasonRangeOperatorExpanded,
+    /// getting the synthetic children failed.
+    eExpressionPathScanEndReasonSyntheticValueMissing,
     eExpressionPathScanEndReasonUnknown = 0xFFFF
   };
 
   enum ExpressionPathEndResultType {
-    eExpressionPathEndResultTypePlain = 1,       // anything but...
-    eExpressionPathEndResultTypeBitfield,        // a bitfield
-    eExpressionPathEndResultTypeBoundedRange,    // a range [low-high]
-    eExpressionPathEndResultTypeUnboundedRange,  // a range []
-    eExpressionPathEndResultTypeValueObjectList, // several items in a VOList
+    /// Anything but...
+    eExpressionPathEndResultTypePlain = 1,
+    /// A bitfield.
+    eExpressionPathEndResultTypeBitfield,
+    /// A range [low-high].
+    eExpressionPathEndResultTypeBoundedRange,
+    /// A range [].
+    eExpressionPathEndResultTypeUnboundedRange,
+    /// Several items in a VOList.
+    eExpressionPathEndResultTypeValueObjectList,
     eExpressionPathEndResultTypeInvalid = 0xFFFF
   };
 
   enum ExpressionPathAftermath {
-    eExpressionPathAftermathNothing = 1, // just return it
-    eExpressionPathAftermathDereference, // dereference the target
-    eExpressionPathAftermathTakeAddress  // take target's address
+    /// Just return it.
+    eExpressionPathAftermathNothing = 1,
+    /// Dereference the target.
+    eExpressionPathAftermathDereference,
+    /// Take target's address.
+    eExpressionPathAftermathTakeAddress
   };
 
   enum ClearUserVisibleDataItems {
@@ -265,14 +272,6 @@ class ValueObject {
       return m_exe_ctx_ref;
     }
 
-    // Set the EvaluationPoint to the values in exe_scope, Return true if the
-    // Evaluation Point changed. Since the ExecutionContextScope is always
-    // going to be valid currently, the Updated Context will also always be
-    // valid.
-
-    //        bool
-    //        SetContext (ExecutionContextScope *exe_scope);
-
     void SetIsConstant() {
       SetUpdated();
       m_mod_id.SetInvalid();
@@ -438,16 +437,16 @@ class ValueObject {
 
   virtual bool SetValueFromCString(const char *value_str, Status &error);
 
-  // Return the module associated with this value object in case the value is
-  // from an executable file and might have its data in sections of the file.
-  // This can be used for variables.
+  /// Return the module associated with this value object in case the value is
+  /// from an executable file and might have its data in sections of the file.
+  /// This can be used for variables.
   virtual lldb::ModuleSP GetModule();
 
   ValueObject *GetRoot();
 
-  // Given a ValueObject, loop over itself and its parent, and its parent's
-  // parent, .. until either the given callback returns false, or you end up at
-  // a null pointer
+  /// Given a ValueObject, loop over itself and its parent, and its parent's
+  /// parent, .. until either the given callback returns false, or you end up at
+  /// a null pointer
   ValueObject *FollowParentChain(std::function<bool(ValueObject *)>);
 
   virtual bool GetDeclaration(Declaration &decl);
@@ -543,9 +542,9 @@ class ValueObject {
 
   lldb::ValueObjectSP GetSP() { return m_manager->GetSharedPointer(this); }
 
-  // Change the name of the current ValueObject. Should *not* be used from a
-  // synthetic child provider as it would change the name of the non synthetic
-  // child as well.
+  /// Change the name of the current ValueObject. Should *not* be used from a
+  /// synthetic child provider as it would change the name of the non synthetic
+  /// child as well.
   void SetName(ConstString name);
 
   virtual lldb::addr_t GetAddressOf(bool scalar_is_load_address = true,
@@ -594,10 +593,10 @@ class ValueObject {
 
   virtual lldb::ValueObjectSP Dereference(Status &error);
 
-  // Creates a copy of the ValueObject with a new name and setting the current
-  // ValueObject as its parent. It should be used when we want to change the
-  // name of a ValueObject without modifying the actual ValueObject itself
-  // (e.g. sythetic child provider).
+  /// Creates a copy of the ValueObject with a new name and setting the current
+  /// ValueObject as its parent. It should be used when we want to change the
+  /// name of a ValueObject without modifying the actual ValueObject itself
+  /// (e.g. sythetic child provider).
   virtual lldb::ValueObjectSP Clone(ConstString new_name);
 
   virtual lldb::ValueObjectSP AddressOf(Status &error);
@@ -616,7 +615,7 @@ class ValueObject {
                                               lldb::TypeSP &type_sp);
 
   // The backing bits of this value object were updated, clear any descriptive
-  // string, so we know we have to refetch them
+  // string, so we know we have to refetch them.
   virtual void ValueUpdated() {
     ClearUserVisibleData(eClearUserVisibleDataItemsValue |
                          eClearUserVisibleDataItemsSummary |
@@ -663,8 +662,8 @@ class ValueObject {
 
   lldb::ValueObjectSP Persist();
 
-  // returns true if this is a char* or a char[] if it is a char* and
-  // check_pointer is true, it also checks that the pointer is valid
+  /// Returns true if this is a char* or a char[] if it is a char* and
+  /// check_pointer is true, it also checks that the pointer is valid.
   bool IsCStringContainer(bool check_pointer = false);
 
   std::pair<size_t, bool>
@@ -948,13 +947,14 @@ class ValueObject {
 
   virtual void CalculateSyntheticValue();
 
-  // Should only be called by ValueObject::GetChildAtIndex() Returns a
-  // ValueObject managed by this ValueObject's manager.
+  /// Should only be called by ValueObject::GetChildAtIndex().
+  ///
+  /// \return A ValueObject managed by this ValueObject's manager.
   virtual ValueObject *CreateChildAtIndex(size_t idx,
                                           bool synthetic_array_member,
                                           int32_t synthetic_index);
 
-  // Should only be called by ValueObject::GetNumChildren()
+  /// Should only be called by ValueObject::GetNumChildren().
   virtual size_t CalculateNumChildren(uint32_t max = UINT32_MAX) = 0;
 
   void SetNumChildren(size_t num_children);
@@ -1003,19 +1003,20 @@ class ValueObject {
   const ValueObject &operator=(const ValueObject &) = delete;
 };
 
-// A value object manager class that is seeded with the static variable value
-// and it vends the user facing value object. If the type is dynamic it can
-// vend the dynamic type. If this user type also has a synthetic type
-// associated with it, it will vend the synthetic type. The class watches the
-// process' stop
-// ID and will update the user type when needed.
+/// A value object manager class that is seeded with the static variable value
+/// and it vends the user facing value object. If the type is dynamic it can
+/// vend the dynamic type. If this user type also has a synthetic type
+/// associated with it, it will vend the synthetic type. The class watches the
+/// process' stop
+/// ID and will update the user type when needed.
 class ValueObjectManager {
-  // The root value object is the static typed variable object.
+  /// The root value object is the static typed variable object.
   lldb::ValueObjectSP m_root_valobj_sp;
-  // The user value object is the value object the user wants to see.
+  /// The user value object is the value object the user wants to see.
   lldb::ValueObjectSP m_user_valobj_sp;
   lldb::DynamicValueType m_use_dynamic;
-  uint32_t m_stop_id; // The stop ID that m_user_valobj_sp is valid for.
+  /// The stop ID that m_user_valobj_sp is valid for.
+  uint32_t m_stop_id;
   bool m_use_synthetic;
 
 public:
@@ -1027,11 +1028,11 @@ class ValueObjectManager {
   bool IsValid() const;
   
   lldb::ValueObjectSP GetRootSP() const { return m_root_valobj_sp; }
-  
-  // Gets the correct value object from the root object for a given process
-  // stop ID. If dynamic values are enabled, or if synthetic children are
-  // enabled, the value object that the user wants to see might change while
-  // debugging.
+
+  /// Gets the correct value object from the root object for a given process
+  /// stop ID. If dynamic values are enabled, or if synthetic children are
+  /// enabled, the value object that the user wants to see might change while
+  /// debugging.
   lldb::ValueObjectSP GetSP();
   
   void SetUseDynamic(lldb::DynamicValueType use_dynamic);

diff  --git a/lldb/include/lldb/Core/ValueObjectCast.h b/lldb/include/lldb/Core/ValueObjectCast.h
index 342803f8ca63a..8205c6f96d2e5 100644
--- a/lldb/include/lldb/Core/ValueObjectCast.h
+++ b/lldb/include/lldb/Core/ValueObjectCast.h
@@ -21,7 +21,7 @@
 namespace lldb_private {
 class ConstString;
 
-// A ValueObject that represents a given value represented as a 
diff erent type.
+/// A ValueObject that represents a given value represented as a 
diff erent type.
 class ValueObjectCast : public ValueObject {
 public:
   ~ValueObjectCast() override;

diff  --git a/lldb/include/lldb/Core/ValueObjectChild.h b/lldb/include/lldb/Core/ValueObjectChild.h
index 9a9fd9294261a..437d81ac3306f 100644
--- a/lldb/include/lldb/Core/ValueObjectChild.h
+++ b/lldb/include/lldb/Core/ValueObjectChild.h
@@ -25,7 +25,7 @@
 
 namespace lldb_private {
 
-// A child of another ValueObject.
+/// A child of another ValueObject.
 class ValueObjectChild : public ValueObject {
 public:
   ~ValueObjectChild() override;
@@ -71,10 +71,6 @@ class ValueObjectChild : public ValueObject {
   bool m_is_deref_of_parent;
   llvm::Optional<LazyBool> m_can_update_with_invalid_exe_ctx;
 
-  //
-  //  void
-  //  ReadValueFromMemory (ValueObject* parent, lldb::addr_t address);
-
   friend class ValueObject;
   friend class ValueObjectConstResult;
   friend class ValueObjectConstResultImpl;

diff  --git a/lldb/include/lldb/Core/ValueObjectConstResult.h b/lldb/include/lldb/Core/ValueObjectConstResult.h
index 8d823baa0b7b4..843eb962ebde1 100644
--- a/lldb/include/lldb/Core/ValueObjectConstResult.h
+++ b/lldb/include/lldb/Core/ValueObjectConstResult.h
@@ -29,7 +29,7 @@ class DataExtractor;
 class ExecutionContextScope;
 class Module;
 
-// A frozen ValueObject copied into host memory
+/// A frozen ValueObject copied into host memory.
 class ValueObjectConstResult : public ValueObject {
 public:
   ~ValueObjectConstResult() override;

diff  --git a/lldb/include/lldb/Core/ValueObjectConstResultImpl.h b/lldb/include/lldb/Core/ValueObjectConstResultImpl.h
index 1316bf66dfdb2..757684d159c34 100644
--- a/lldb/include/lldb/Core/ValueObjectConstResultImpl.h
+++ b/lldb/include/lldb/Core/ValueObjectConstResultImpl.h
@@ -26,9 +26,9 @@ class ValueObject;
 
 namespace lldb_private {
 
-// A class wrapping common implementation details for operations in
-// ValueObjectConstResult ( & Child ) that may need to jump from the host
-// memory space into the target's memory space
+/// A class wrapping common implementation details for operations in
+/// ValueObjectConstResult ( & Child ) that may need to jump from the host
+/// memory space into the target's memory space.
 class ValueObjectConstResultImpl {
 public:
   ValueObjectConstResultImpl(ValueObject *valobj,

diff  --git a/lldb/include/lldb/Core/ValueObjectDynamicValue.h b/lldb/include/lldb/Core/ValueObjectDynamicValue.h
index 2806857339efb..7e6af70e58168 100644
--- a/lldb/include/lldb/Core/ValueObjectDynamicValue.h
+++ b/lldb/include/lldb/Core/ValueObjectDynamicValue.h
@@ -28,8 +28,8 @@ class DataExtractor;
 class Declaration;
 class Status;
 
-// A ValueObject that represents memory at a given address, viewed as some
-// set lldb type.
+/// A ValueObject that represents memory at a given address, viewed as some
+/// set lldb type.
 class ValueObjectDynamicValue : public ValueObject {
 public:
   ~ValueObjectDynamicValue() override;

diff  --git a/lldb/include/lldb/Core/ValueObjectList.h b/lldb/include/lldb/Core/ValueObjectList.h
index f99fba41aa263..9bfccff0771ca 100644
--- a/lldb/include/lldb/Core/ValueObjectList.h
+++ b/lldb/include/lldb/Core/ValueObjectList.h
@@ -19,7 +19,7 @@
 namespace lldb_private {
 class ValueObject;
 
-// A collection of ValueObject values that
+/// A collection of ValueObject values that.
 class ValueObjectList {
 public:
   const ValueObjectList &operator=(const ValueObjectList &rhs);

diff  --git a/lldb/include/lldb/Core/ValueObjectMemory.h b/lldb/include/lldb/Core/ValueObjectMemory.h
index b5d5e6ecf4c0e..1ce9e501a0c0b 100644
--- a/lldb/include/lldb/Core/ValueObjectMemory.h
+++ b/lldb/include/lldb/Core/ValueObjectMemory.h
@@ -24,8 +24,8 @@
 namespace lldb_private {
 class ExecutionContextScope;
 
-// A ValueObject that represents memory at a given address, viewed as some
-// set lldb type.
+/// A ValueObject that represents memory at a given address, viewed as some
+/// set lldb type.
 class ValueObjectMemory : public ValueObject {
 public:
   ~ValueObjectMemory() override;

diff  --git a/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h b/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
index 41c461ce13f0d..a4148a217209a 100644
--- a/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
+++ b/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
@@ -27,11 +27,11 @@ class Declaration;
 class Status;
 class SyntheticChildrenFrontEnd;
 
-// A ValueObject that obtains its children from some source other than
-// real information
-// This is currently used to implement Python-based children and filters but
-// you can bind it to any source of synthetic information and have it behave
-// accordingly
+/// A ValueObject that obtains its children from some source other than
+/// real information.
+/// This is currently used to implement Python-based children and filters but
+/// you can bind it to any source of synthetic information and have it behave
+/// accordingly.
 class ValueObjectSynthetic : public ValueObject {
 public:
   ~ValueObjectSynthetic() override;
@@ -148,9 +148,9 @@ class ValueObjectSynthetic : public ValueObject {
   /// Guarded by m_child_mutex;
   SyntheticChildrenCache m_synthetic_children_cache;
 
-  uint32_t m_synthetic_children_count; // FIXME use the ValueObject's
-                                       // ChildrenManager instead of a special
-                                       // purpose solution
+  // FIXME: use the ValueObject's  ChildrenManager instead of a special purpose
+  // solution.
+  uint32_t m_synthetic_children_count;
 
   ConstString m_parent_type_name;
 

diff  --git a/lldb/include/lldb/Core/ValueObjectVariable.h b/lldb/include/lldb/Core/ValueObjectVariable.h
index 23fdedbf5a4a6..95955d60009be 100644
--- a/lldb/include/lldb/Core/ValueObjectVariable.h
+++ b/lldb/include/lldb/Core/ValueObjectVariable.h
@@ -28,8 +28,8 @@ class Status;
 class ExecutionContextScope;
 class SymbolContextScope;
 
-// A ValueObject that contains a root variable that may or may not
-// have children.
+/// A ValueObject that contains a root variable that may or may not
+/// have children.
 class ValueObjectVariable : public ValueObject {
 public:
   ~ValueObjectVariable() override;
@@ -72,10 +72,11 @@ class ValueObjectVariable : public ValueObject {
 
   CompilerType GetCompilerTypeImpl() override;
 
-  lldb::VariableSP
-      m_variable_sp;      ///< The variable that this value object is based upon
-  Value m_resolved_value; ///< The value that DWARFExpression resolves this
-                          ///variable to before we patch it up
+  /// The variable that this value object is based upon.
+  lldb::VariableSP m_variable_sp;
+  ///< The value that DWARFExpression resolves this variable to before we patch
+  ///< it up.
+  Value m_resolved_value;
 
 private:
   ValueObjectVariable(ExecutionContextScope *exe_scope,


        


More information about the lldb-commits mailing list