[Lldb-commits] [PATCH] D89351: Move initialization of Variable::m_loc_is_const_data into constructor (NFC)

Adrian Prantl via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 13 16:58:54 PDT 2020


aprantl created this revision.
aprantl added a reviewer: JDevlieghere.
aprantl requested review of this revision.

This makes it symmetric with all other flags and makes it easier to not forget to initialize it.


https://reviews.llvm.org/D89351

Files:
  lldb/include/lldb/Symbol/Variable.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  lldb/source/Symbol/Variable.cpp


Index: lldb/source/Symbol/Variable.cpp
===================================================================
--- lldb/source/Symbol/Variable.cpp
+++ lldb/source/Symbol/Variable.cpp
@@ -40,12 +40,13 @@
                    ValueType scope, SymbolContextScope *context,
                    const RangeList &scope_range, Declaration *decl_ptr,
                    const DWARFExpression &location, bool external,
-                   bool artificial, bool static_member)
+                   bool artificial, bool location_is_constant_data,
+                   bool static_member)
     : UserID(uid), m_name(name), m_mangled(ConstString(mangled)),
       m_symfile_type_sp(symfile_type_sp), m_scope(scope),
       m_owner_scope(context), m_scope_range(scope_range),
       m_declaration(decl_ptr), m_location(location), m_external(external),
-      m_artificial(artificial), m_loc_is_const_data(false),
+      m_artificial(artificial), m_loc_is_const_data(location_is_constant_data),
       m_static_member(static_member) {}
 
 Variable::~Variable() {}
Index: lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -1018,8 +1018,8 @@
 
   var_sp = std::make_shared<Variable>(
       var_uid, var_name.c_str(), mangled_cstr, type_sp, scope, context_scope,
-      ranges, &decl, location, is_external, is_artificial, is_static_member);
-  var_sp->SetLocationIsConstantValueData(is_constant);
+      ranges, &decl, location, is_external, is_artificial, is_constant,
+      is_static_member);
 
   m_variables.insert(std::make_pair(var_uid, var_sp));
   return var_sp;
Index: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -820,8 +820,7 @@
   VariableSP var_sp = std::make_shared<Variable>(
       toOpaqueUid(var_id), name.str().c_str(), global_name.c_str(), type_sp,
       scope, comp_unit.get(), ranges, &decl, location, is_external, false,
-      false);
-  var_sp->SetLocationIsConstantValueData(false);
+      false, false);
 
   return var_sp;
 }
@@ -848,8 +847,7 @@
   VariableSP var_sp = std::make_shared<Variable>(
       toOpaqueUid(var_id), constant.Name.str().c_str(), global_name.c_str(),
       type_sp, eValueTypeVariableGlobal, module.get(), ranges, &decl, location,
-      false, false, false);
-  var_sp->SetLocationIsConstantValueData(true);
+      false, false, true, false);
   return var_sp;
 }
 
@@ -1354,7 +1352,7 @@
   VariableSP var_sp = std::make_shared<Variable>(
       toOpaqueUid(var_id), name.c_str(), name.c_str(), sftype, var_scope,
       comp_unit_sp.get(), *var_info.ranges, &decl, *var_info.location, false,
-      false, false);
+      false, false, false);
 
   if (!is_param)
     m_ast->GetOrCreateVariableDecl(scope_id, var_id);
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -3418,9 +3418,7 @@
     var_sp = std::make_shared<Variable>(
         die.GetID(), name, mangled, type_sp, scope, symbol_context_scope,
         scope_ranges, &decl, location, is_external, is_artificial,
-        is_static_member);
-
-    var_sp->SetLocationIsConstantValueData(location_is_const_value_data);
+        location_is_const_value_data, is_static_member);
   } else {
     // Not ready to parse this variable yet. It might be a global or static
     // variable that is in a function scope and the function in the symbol
Index: lldb/include/lldb/Symbol/Variable.h
===================================================================
--- lldb/include/lldb/Symbol/Variable.h
+++ lldb/include/lldb/Symbol/Variable.h
@@ -33,7 +33,8 @@
            const lldb::SymbolFileTypeSP &symfile_type_sp, lldb::ValueType scope,
            SymbolContextScope *owner_scope, const RangeList &scope_range,
            Declaration *decl, const DWARFExpression &location, bool external,
-           bool artificial, bool static_member = false);
+           bool artificial, bool location_is_constant_data,
+           bool static_member = false);
 
   virtual ~Variable();
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89351.297997.patch
Type: text/x-patch
Size: 4493 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20201013/e03e5f39/attachment.bin>


More information about the lldb-commits mailing list