[Lldb-commits] [lldb] 834708a - [lldb][NFC] Rename ClangExpressionDeclMap::AddThisType and clarify documentation

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 10 03:27:42 PDT 2020


Author: Raphael Isemann
Date: 2020-06-10T12:26:47+02:00
New Revision: 834708a6a0d04935d79bfa54c7a1bf9ab7a2ba8f

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

LOG: [lldb][NFC] Rename ClangExpressionDeclMap::AddThisType and clarify documentation

Added: 
    

Modified: 
    lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
    lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index 7d40cd0e8a0e..d71036f793b1 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -759,7 +759,7 @@ void ClangExpressionDeclMap::LookUpLldbClass(NameSearchContext &context) {
     if (!ctx_obj_ptr || status.Fail())
       return;
 
-    AddThisType(context, TypeFromUser(m_ctx_obj->GetCompilerType()));
+    AddContextClassType(context, TypeFromUser(m_ctx_obj->GetCompilerType()));
 
     m_struct_vars->m_object_pointer_type =
         TypeFromUser(ctx_obj_ptr->GetCompilerType());
@@ -797,7 +797,7 @@ void ClangExpressionDeclMap::LookUpLldbClass(NameSearchContext &context) {
     LLDB_LOG(log, "  CEDM::FEVD Adding type for $__lldb_class: {1}",
              class_qual_type.getAsString());
 
-    AddThisType(context, class_user_type);
+    AddContextClassType(context, class_user_type);
 
     if (method_decl->isInstance()) {
       // self is a pointer to the object
@@ -839,7 +839,7 @@ void ClangExpressionDeclMap::LookUpLldbClass(NameSearchContext &context) {
     LLDB_LOG(log, "  FEVD Adding type for $__lldb_class: {1}",
              ClangUtil::GetQualType(pointee_type).getAsString());
 
-    AddThisType(context, pointee_type);
+    AddContextClassType(context, pointee_type);
     TypeFromUser this_user_type(this_type->GetFullCompilerType());
     m_struct_vars->m_object_pointer_type = this_user_type;
   }
@@ -1876,8 +1876,8 @@ void ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context,
   }
 }
 
-void ClangExpressionDeclMap::AddThisType(NameSearchContext &context,
-                                         const TypeFromUser &ut) {
+void ClangExpressionDeclMap::AddContextClassType(NameSearchContext &context,
+                                                 const TypeFromUser &ut) {
   CompilerType copied_clang_type = GuardedCopyType(ut);
 
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));

diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
index 2dc921608348..6974535a8993 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
@@ -588,15 +588,19 @@ class ClangExpressionDeclMap : public ClangASTSource {
   ///     The type that needs to be created.
   void AddOneType(NameSearchContext &context, const TypeFromUser &type);
 
-  /// Generate a Decl for "*this" and add a member function declaration to it
-  /// for the expression, then report it.
+  /// Adds the class in which the expression is evaluated to the lookup and
+  /// prepares the class to be used as a context for expression evaluation (for
+  /// example, it creates a fake member function that will contain the
+  /// expression LLDB is trying to evaluate).
   ///
   /// \param[in] context
-  ///     The NameSearchContext to use when constructing the Decl.
+  ///     The NameSearchContext to which the class should be added as a lookup
+  ///     result.
   ///
   /// \param[in] type
-  ///     The type for *this.
-  void AddThisType(NameSearchContext &context, const TypeFromUser &type);
+  ///     The type of the class that serves as the evaluation context.
+  void AddContextClassType(NameSearchContext &context,
+                           const TypeFromUser &type);
 
   /// Move a type out of the current ASTContext into another, but make sure to
   /// export all components of the type also.


        


More information about the lldb-commits mailing list