Skip to content

Commit a9a62f2

Browse files
committed
Swap FileSpec for SupportFile
1 parent 0914ecd commit a9a62f2

File tree

5 files changed

+14
-13
lines changed

5 files changed

+14
-13
lines changed

lldb/include/lldb/Symbol/LineEntry.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,15 @@ struct LineEntry {
130130
/// Shared pointer to the target this LineEntry belongs to.
131131
void ApplyFileMappings(lldb::TargetSP target_sp);
132132

133-
const FileSpec& GetFile() const { return file; }
134-
void SetFile(const FileSpec& file_spec) { file = file_spec; }
133+
const FileSpec& GetFile() const { return file_sp->GetSpecOnly(); }
134+
void SetFile(lldb::SupportFileSP support_file_sp) { file_sp = support_file_sp; }
135135

136136
/// The section offset address range for this line entry.
137137
AddressRange range;
138138

139139
private:
140140
/// The source file, possibly mapped by the target.source-map setting.
141-
FileSpec file;
141+
lldb::SupportFileSP file_sp;
142142
public:
143143

144144
/// The original source file, from debug info.

lldb/source/API/SBLineEntry.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ void SBLineEntry::SetFileSpec(lldb::SBFileSpec filespec) {
109109
LLDB_INSTRUMENT_VA(this, filespec);
110110

111111
if (filespec.IsValid())
112-
ref().SetFile(filespec.ref());
112+
ref().SetFile(std::make_shared<SupportFile>(filespec.ref()));
113113
else
114-
ref().SetFile(FileSpec());
114+
ref().SetFile(std::make_shared<SupportFile>());
115115
}
116116
void SBLineEntry::SetLine(uint32_t line) {
117117
LLDB_INSTRUMENT_VA(this, line);

lldb/source/Symbol/LineEntry.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
using namespace lldb_private;
1515

1616
LineEntry::LineEntry()
17-
: range(), file(), is_start_of_statement(0), is_start_of_basic_block(0),
17+
: range(), is_start_of_statement(0), is_start_of_basic_block(0),
1818
is_prologue_end(0), is_epilogue_begin(0), is_terminal_entry(0) {}
1919

2020
void LineEntry::Clear() {
2121
range.Clear();
22-
file.Clear();
22+
file_sp = std::make_shared<SupportFile>();
2323
original_file_sp = std::make_shared<SupportFile>();
2424
line = LLDB_INVALID_LINE_NUMBER;
2525
column = 0;
@@ -35,6 +35,7 @@ bool LineEntry::IsValid() const {
3535
}
3636

3737
bool LineEntry::DumpStopContext(Stream *s, bool show_fullpaths) const {
38+
const FileSpec& file = file_sp->GetSpecOnly();
3839
if (file) {
3940
if (show_fullpaths)
4041
file.Dump(s->AsRawOstream());
@@ -67,7 +68,7 @@ bool LineEntry::Dump(Stream *s, Target *target, bool show_file,
6768
return false;
6869
}
6970
if (show_file)
70-
*s << ", file = " << file;
71+
*s << ", file = " << GetFile();
7172
if (line)
7273
s->Printf(", line = %u", line);
7374
if (column)
@@ -103,7 +104,7 @@ bool LineEntry::GetDescription(Stream *s, lldb::DescriptionLevel level,
103104
Address::DumpStyleFileAddress);
104105
}
105106

106-
*s << ": " << file;
107+
*s << ": " << GetFile();
107108

108109
if (line) {
109110
s->Printf(":%u", line);
@@ -173,7 +174,7 @@ int LineEntry::Compare(const LineEntry &a, const LineEntry &b) {
173174
if (a.column > b.column)
174175
return +1;
175176

176-
return FileSpec::Compare(a.file, b.file, true);
177+
return FileSpec::Compare(a.GetFile(), b.GetFile(), true);
177178
}
178179

179180
AddressRange LineEntry::GetSameLineContiguousAddressRange(
@@ -242,6 +243,6 @@ void LineEntry::ApplyFileMappings(lldb::TargetSP target_sp) {
242243
// Apply any file remappings to our file.
243244
if (auto new_file_spec = target_sp->GetSourcePathMap().FindFile(
244245
original_file_sp->GetSpecOnly()))
245-
file = *new_file_spec;
246+
file_sp->Update(*new_file_spec);
246247
}
247248
}

lldb/source/Symbol/LineTable.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ bool LineTable::ConvertEntryAtIndexToLineEntry(uint32_t idx,
289289
line_entry.range.SetByteSize(0);
290290

291291
line_entry.SetFile(
292-
m_comp_unit->GetSupportFiles().GetFileSpecAtIndex(entry.file_idx));
292+
m_comp_unit->GetSupportFiles().GetSupportFileAtIndex(entry.file_idx));
293293
line_entry.original_file_sp =
294294
m_comp_unit->GetSupportFiles().GetSupportFileAtIndex(entry.file_idx);
295295
line_entry.line = entry.line;

lldb/source/Symbol/SymbolContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ bool SymbolContext::GetParentOfInlinedScope(const Address &curr_frame_pc,
473473
next_frame_pc = range.GetBaseAddress();
474474
next_frame_sc.line_entry.range.GetBaseAddress() = next_frame_pc;
475475
next_frame_sc.line_entry.SetFile(
476-
curr_inlined_block_inlined_info->GetCallSite().GetFile());
476+
std::make_shared<SupportFile>(curr_inlined_block_inlined_info->GetCallSite().GetFile()));
477477
next_frame_sc.line_entry.original_file_sp =
478478
std::make_shared<SupportFile>(
479479
curr_inlined_block_inlined_info->GetCallSite().GetFile());

0 commit comments

Comments
 (0)