[Lldb-commits] [lldb] 3d7b591 - [lldb][NFC] Pointer to reference conversion for CompilerDeclContext params in ClangExpressionDeclMap.

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 19 05:45:45 PST 2020


Author: Raphael Isemann
Date: 2020-02-19T14:45:23+01:00
New Revision: 3d7b591dca83595ebcca04f94260f1f4901b8956

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

LOG: [lldb][NFC] Pointer to reference conversion for CompilerDeclContext params in ClangExpressionDeclMap.

Follow up for f9568a95493aea3ea813bd37cb8c084ec4294e38.

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 f4c6cb2a79a8..5b776fb4a100 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -593,11 +593,11 @@ addr_t ClangExpressionDeclMap::GetSymbolAddress(ConstString name,
 
 lldb::VariableSP ClangExpressionDeclMap::FindGlobalVariable(
     Target &target, ModuleSP &module, ConstString name,
-    CompilerDeclContext *namespace_decl) {
+    const CompilerDeclContext &namespace_decl) {
   VariableList vars;
 
   if (module && namespace_decl)
-    module->FindGlobalVariables(name, *namespace_decl, -1, vars);
+    module->FindGlobalVariables(name, namespace_decl, -1, vars);
   else
     target.GetImages().FindGlobalVariables(name, -1, vars);
 
@@ -1073,7 +1073,7 @@ void ClangExpressionDeclMap::LookupInModulesDeclVendor(
 
 bool ClangExpressionDeclMap::LookupLocalVariable(
     NameSearchContext &context, ConstString name, unsigned current_id,
-    SymbolContext &sym_ctx, CompilerDeclContext &namespace_decl) {
+    SymbolContext &sym_ctx, const CompilerDeclContext &namespace_decl) {
   if (sym_ctx.block == nullptr)
     return false;
 
@@ -1213,11 +1213,9 @@ SymbolContextList ClangExpressionDeclMap::SearchFunctionsInSymbolContexts(
   return sc_func_list;
 }
 
-void ClangExpressionDeclMap::LookupFunction(NameSearchContext &context,
-                                            lldb::ModuleSP module_sp,
-                                            ConstString name,
-                                            CompilerDeclContext &namespace_decl,
-                                            unsigned current_id) {
+void ClangExpressionDeclMap::LookupFunction(
+    NameSearchContext &context, lldb::ModuleSP module_sp, ConstString name,
+    const CompilerDeclContext &namespace_decl, unsigned current_id) {
   if (!m_parser_vars)
     return;
 
@@ -1339,7 +1337,7 @@ void ClangExpressionDeclMap::LookupFunction(NameSearchContext &context,
 
 void ClangExpressionDeclMap::FindExternalVisibleDecls(
     NameSearchContext &context, lldb::ModuleSP module_sp,
-    CompilerDeclContext &namespace_decl, unsigned int current_id) {
+    const CompilerDeclContext &namespace_decl, unsigned int current_id) {
   assert(m_ast_context);
 
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
@@ -1424,7 +1422,7 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
   if (target) {
     ValueObjectSP valobj;
     VariableSP var;
-    var = FindGlobalVariable(*target, module_sp, name, &namespace_decl);
+    var = FindGlobalVariable(*target, module_sp, name, namespace_decl);
 
     if (var) {
       valobj = ValueObjectVariable::Create(target, var);

diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
index e8dd62a70a5b..72f8807fe775 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
@@ -281,7 +281,7 @@ class ClangExpressionDeclMap : public ClangASTSource {
   ///     for logging purposes.
   void FindExternalVisibleDecls(NameSearchContext &context,
                                 lldb::ModuleSP module,
-                                CompilerDeclContext &namespace_decl,
+                                const CompilerDeclContext &namespace_decl,
                                 unsigned int current_id);
 
 protected:
@@ -468,7 +468,7 @@ class ClangExpressionDeclMap : public ClangASTSource {
   ///    True iff a local variable was found.
   bool LookupLocalVariable(NameSearchContext &context, ConstString name,
                            unsigned current_id, SymbolContext &sym_ctx,
-                           CompilerDeclContext &namespace_decl);
+                           const CompilerDeclContext &namespace_decl);
 
   /// Searches for functions in the given SymbolContextList.
   ///
@@ -505,7 +505,8 @@ class ClangExpressionDeclMap : public ClangASTSource {
   ///     The ID for the current FindExternalVisibleDecls invocation,
   ///     for logging purposes.
   void LookupFunction(NameSearchContext &context, lldb::ModuleSP module_sp,
-                      ConstString name, CompilerDeclContext &namespace_decl,
+                      ConstString name,
+                      const CompilerDeclContext &namespace_decl,
                       unsigned current_id);
 
   /// Given a target, find a variable that matches the given name and type.
@@ -524,9 +525,9 @@ class ClangExpressionDeclMap : public ClangASTSource {
   ///
   /// \return
   ///     The LLDB Variable found, or NULL if none was found.
-  lldb::VariableSP FindGlobalVariable(Target &target, lldb::ModuleSP &module,
-                                      ConstString name,
-                                      CompilerDeclContext *namespace_decl);
+  lldb::VariableSP
+  FindGlobalVariable(Target &target, lldb::ModuleSP &module, ConstString name,
+                     const CompilerDeclContext &namespace_decl);
 
   /// Get the value of a variable in a given execution context and return the
   /// associated Types if needed.


        


More information about the lldb-commits mailing list