Skip to content

Commit 9b1c06c

Browse files
committed
Move initialization of Variable::m_loc_is_const_data into constructor (NFC)
This makes it symmetric with all other flags and makes it easier to not forget to initialize it. https://reviews.llvm.org/D89351
1 parent 24c1660 commit 9b1c06c

File tree

5 files changed

+11
-13
lines changed

5 files changed

+11
-13
lines changed

lldb/include/lldb/Symbol/Variable.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ class Variable : public UserID, public std::enable_shared_from_this<Variable> {
3333
const lldb::SymbolFileTypeSP &symfile_type_sp, lldb::ValueType scope,
3434
SymbolContextScope *owner_scope, const RangeList &scope_range,
3535
Declaration *decl, const DWARFExpression &location, bool external,
36-
bool artificial, bool static_member = false);
36+
bool artificial, bool location_is_constant_data,
37+
bool static_member = false);
3738

3839
virtual ~Variable();
3940

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3418,9 +3418,7 @@ VariableSP SymbolFileDWARF::ParseVariableDIE(const SymbolContext &sc,
34183418
var_sp = std::make_shared<Variable>(
34193419
die.GetID(), name, mangled, type_sp, scope, symbol_context_scope,
34203420
scope_ranges, &decl, location, is_external, is_artificial,
3421-
is_static_member);
3422-
3423-
var_sp->SetLocationIsConstantValueData(location_is_const_value_data);
3421+
location_is_const_value_data, is_static_member);
34243422
} else {
34253423
// Not ready to parse this variable yet. It might be a global or static
34263424
// variable that is in a function scope and the function in the symbol

lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -820,8 +820,7 @@ VariableSP SymbolFileNativePDB::CreateGlobalVariable(PdbGlobalSymId var_id) {
820820
VariableSP var_sp = std::make_shared<Variable>(
821821
toOpaqueUid(var_id), name.str().c_str(), global_name.c_str(), type_sp,
822822
scope, comp_unit.get(), ranges, &decl, location, is_external, false,
823-
false);
824-
var_sp->SetLocationIsConstantValueData(false);
823+
false, false);
825824

826825
return var_sp;
827826
}
@@ -848,8 +847,7 @@ SymbolFileNativePDB::CreateConstantSymbol(PdbGlobalSymId var_id,
848847
VariableSP var_sp = std::make_shared<Variable>(
849848
toOpaqueUid(var_id), constant.Name.str().c_str(), global_name.c_str(),
850849
type_sp, eValueTypeVariableGlobal, module.get(), ranges, &decl, location,
851-
false, false, false);
852-
var_sp->SetLocationIsConstantValueData(true);
850+
false, false, true, false);
853851
return var_sp;
854852
}
855853

@@ -1354,7 +1352,7 @@ VariableSP SymbolFileNativePDB::CreateLocalVariable(PdbCompilandSymId scope_id,
13541352
VariableSP var_sp = std::make_shared<Variable>(
13551353
toOpaqueUid(var_id), name.c_str(), name.c_str(), sftype, var_scope,
13561354
comp_unit_sp.get(), *var_info.ranges, &decl, *var_info.location, false,
1357-
false, false);
1355+
false, false, false);
13581356

13591357
if (!is_param)
13601358
m_ast->GetOrCreateVariableDecl(scope_id, var_id);

lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,8 +1018,8 @@ VariableSP SymbolFilePDB::ParseVariableForPDBData(
10181018

10191019
var_sp = std::make_shared<Variable>(
10201020
var_uid, var_name.c_str(), mangled_cstr, type_sp, scope, context_scope,
1021-
ranges, &decl, location, is_external, is_artificial, is_static_member);
1022-
var_sp->SetLocationIsConstantValueData(is_constant);
1021+
ranges, &decl, location, is_external, is_artificial, is_constant,
1022+
is_static_member);
10231023

10241024
m_variables.insert(std::make_pair(var_uid, var_sp));
10251025
return var_sp;

lldb/source/Symbol/Variable.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,13 @@ Variable::Variable(lldb::user_id_t uid, const char *name, const char *mangled,
4040
ValueType scope, SymbolContextScope *context,
4141
const RangeList &scope_range, Declaration *decl_ptr,
4242
const DWARFExpression &location, bool external,
43-
bool artificial, bool static_member)
43+
bool artificial, bool location_is_constant_data,
44+
bool static_member)
4445
: UserID(uid), m_name(name), m_mangled(ConstString(mangled)),
4546
m_symfile_type_sp(symfile_type_sp), m_scope(scope),
4647
m_owner_scope(context), m_scope_range(scope_range),
4748
m_declaration(decl_ptr), m_location(location), m_external(external),
48-
m_artificial(artificial), m_loc_is_const_data(false),
49+
m_artificial(artificial), m_loc_is_const_data(location_is_constant_data),
4950
m_static_member(static_member) {}
5051

5152
Variable::~Variable() {}

0 commit comments

Comments
 (0)