[Lldb-commits] [lldb] 3647ff1 - Used std::vector::reserve when I meant std::vector::resize.

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 13 16:12:28 PST 2024


Author: Jim Ingham
Date: 2024-02-13T16:12:20-08:00
New Revision: 3647ff159a2f2445c45d9cbb4f8791b5f30da16b

URL: https://github.com/llvm/llvm-project/commit/3647ff159a2f2445c45d9cbb4f8791b5f30da16b
DIFF: https://github.com/llvm/llvm-project/commit/3647ff159a2f2445c45d9cbb4f8791b5f30da16b.diff

LOG: Used std::vector::reserve when I meant std::vector::resize.

The Linux std has more asserts enabled by default, so it
complained, even though this worked on Darwin...

Added: 
    

Modified: 
    lldb/source/Commands/CommandObjectCommands.cpp
    lldb/test/API/commands/command/script/add/TestAddParsedCommand.py

Removed: 
    


################################################################################
diff  --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp
index 3dfd452b92509d..b7cd65059b2214 100644
--- a/lldb/source/Commands/CommandObjectCommands.cpp
+++ b/lldb/source/Commands/CommandObjectCommands.cpp
@@ -1419,9 +1419,9 @@ class CommandObjectScriptingObjectParsed : public CommandObjectParsed {
       m_options_definition_up.reset(new OptionDefinition[m_num_options]);
       // We need to hand out pointers to contents of these vectors; we reserve
       // as much as we'll need up front so they don't get freed on resize...
-      m_usage_container.reserve(m_num_options);
-      m_enum_storage.reserve(m_num_options);
-      m_enum_vector.reserve(m_num_options);
+      m_usage_container.resize(m_num_options);
+      m_enum_storage.resize(m_num_options);
+      m_enum_vector.resize(m_num_options);
       
       size_t counter = 0;
       size_t short_opt_counter = 0;

diff  --git a/lldb/test/API/commands/command/script/add/TestAddParsedCommand.py b/lldb/test/API/commands/command/script/add/TestAddParsedCommand.py
index c044e2bf8c8d28..bbf330500568b5 100644
--- a/lldb/test/API/commands/command/script/add/TestAddParsedCommand.py
+++ b/lldb/test/API/commands/command/script/add/TestAddParsedCommand.py
@@ -15,7 +15,6 @@ class ParsedCommandTestCase(TestBase):
 
     # This crashes on the x86_64 Debian bot, but the failure is not helpful.
     # Disable the test while I try to find a way to reproduce.
-    @skipIfLinux 
     def test(self):
         self.pycmd_tests()
 


        


More information about the lldb-commits mailing list