Skip to content

Move initialization of Variable::m_loc_is_const_data into constructor… #1955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lldb/include/lldb/Symbol/Variable.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class Variable : public UserID, public std::enable_shared_from_this<Variable> {
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();

Expand Down
4 changes: 1 addition & 3 deletions lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3430,9 +3430,7 @@ VariableSP SymbolFileDWARF::ParseVariableDIE(const SymbolContext &sc,
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -812,8 +812,7 @@ VariableSP SymbolFileNativePDB::CreateGlobalVariable(PdbGlobalSymId var_id) {
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;
}
Expand All @@ -840,8 +839,7 @@ SymbolFileNativePDB::CreateConstantSymbol(PdbGlobalSymId var_id,
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;
}

Expand Down Expand Up @@ -1346,7 +1344,7 @@ VariableSP SymbolFileNativePDB::CreateLocalVariable(PdbCompilandSymId scope_id,
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);
Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1020,8 +1020,8 @@ VariableSP SymbolFilePDB::ParseVariableForPDBData(

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;
Expand Down
5 changes: 3 additions & 2 deletions lldb/source/Symbol/Variable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ Variable::Variable(lldb::user_id_t uid, const char *name, const char *mangled,
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() {}
Expand Down