Author: Pavel Labath Date: 2020-01-21T15:04:27+01:00 New Revision: 5e70f4bdc15960730d0ff2aa167399e36bc64278
URL: https://github.com/llvm/llvm-project/commit/5e70f4bdc15960730d0ff2aa167399e36bc64278 DIFF: https://github.com/llvm/llvm-project/commit/5e70f4bdc15960730d0ff2aa167399e36bc64278.diff LOG: [lldb/breakpad] Use new line table constructor The old construction method can be quadratic for some inputs. This approach guarantees a reasonable performance. Added: Modified: lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp Removed: ################################################################################ diff --git a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp index b2c4d0883341..0d251c9e2e0a 100644 --- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp +++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp @@ -694,18 +694,18 @@ void SymbolFileBreakpad::ParseLineTableAndSupportFiles(CompileUnit &cu, "How did we create compile units without a base address?"); SupportFileMap map; - data.line_table_up = std::make_unique<LineTable>(&cu); - std::unique_ptr<LineSequence> line_seq_up( - data.line_table_up->CreateLineSequenceContainer()); + std::vector<std::unique_ptr<LineSequence>> sequences; + std::unique_ptr<LineSequence> line_seq_up = + LineTable::CreateLineSequenceContainer(); llvm::Optional<addr_t> next_addr; auto finish_sequence = [&]() { - data.line_table_up->AppendLineEntryToSequence( + LineTable::AppendLineEntryToSequence( line_seq_up.get(), *next_addr, /*line*/ 0, /*column*/ 0, /*file_idx*/ 0, /*is_start_of_statement*/ false, /*is_start_of_basic_block*/ false, /*is_prologue_end*/ false, /*is_epilogue_begin*/ false, /*is_terminal_entry*/ true); - data.line_table_up->InsertSequence(line_seq_up.get()); - line_seq_up->Clear(); + sequences.push_back(std::move(line_seq_up)); + line_seq_up = LineTable::CreateLineSequenceContainer(); }; LineIterator It(*m_objfile_sp, Record::Func, data.bookmark), @@ -722,7 +722,7 @@ void SymbolFileBreakpad::ParseLineTableAndSupportFiles(CompileUnit &cu, // Discontiguous entries. Finish off the previous sequence and reset. finish_sequence(); } - data.line_table_up->AppendLineEntryToSequence( + LineTable::AppendLineEntryToSequence( line_seq_up.get(), record->Address, record->LineNum, /*column*/ 0, map[record->FileNum], /*is_start_of_statement*/ true, /*is_start_of_basic_block*/ false, /*is_prologue_end*/ false, @@ -731,6 +731,7 @@ void SymbolFileBreakpad::ParseLineTableAndSupportFiles(CompileUnit &cu, } if (next_addr) finish_sequence(); + data.line_table_up = std::make_unique<LineTable>(&cu, std::move(sequences)); data.support_files = map.translate(cu.GetPrimaryFile(), *m_files); } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits