[Lldb-commits] [lldb] r369237 - [lldb][NFC] Address review comments to StringList for-loop support
Raphael Isemann via lldb-commits
lldb-commits at lists.llvm.org
Mon Aug 19 00:22:19 PDT 2019
Author: teemperor
Date: Mon Aug 19 00:22:19 2019
New Revision: 369237
URL: http://llvm.org/viewvc/llvm-project?rev=369237&view=rev
Log:
[lldb][NFC] Address review comments to StringList for-loop support
Modified:
lldb/trunk/include/lldb/Utility/StringList.h
lldb/trunk/source/Commands/CommandObjectType.cpp
lldb/trunk/source/Utility/StringList.cpp
lldb/trunk/unittests/Utility/StringListTest.cpp
Modified: lldb/trunk/include/lldb/Utility/StringList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/StringList.h?rev=369237&r1=369236&r2=369237&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Utility/StringList.h (original)
+++ lldb/trunk/include/lldb/Utility/StringList.h Mon Aug 19 00:22:19 2019
@@ -23,7 +23,7 @@ class Stream;
namespace lldb_private {
class StringList {
- typedef std::vector<std::string> StorageType;
+ typedef std::vector<std::string> collection;
public:
StringList();
@@ -54,8 +54,8 @@ public:
size_t GetMaxStringLength() const;
- typedef StorageType::iterator iterator;
- typedef StorageType::const_iterator const_iterator;
+ typedef collection::iterator iterator;
+ typedef collection::const_iterator const_iterator;
iterator begin() { return m_strings.begin(); }
iterator end() { return m_strings.end(); }
@@ -135,7 +135,7 @@ public:
}
private:
- StorageType m_strings;
+ collection m_strings;
};
} // namespace lldb_private
Modified: lldb/trunk/source/Commands/CommandObjectType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=369237&r1=369236&r2=369237&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectType.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectType.cpp Mon Aug 19 00:22:19 2019
@@ -436,10 +436,9 @@ protected:
Status error;
for (const std::string &type_name : options->m_target_types) {
- ConstString const_type_name(type_name);
- if (const_type_name) {
+ if (!type_name.empty()) {
if (!CommandObjectTypeSynthAdd::AddSynth(
- const_type_name, synth_provider,
+ ConstString(type_name), synth_provider,
options->m_regex
? CommandObjectTypeSynthAdd::eRegexSynth
: CommandObjectTypeSynthAdd::eRegularSynth,
Modified: lldb/trunk/source/Utility/StringList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/StringList.cpp?rev=369237&r1=369236&r2=369237&view=diff
==============================================================================
--- lldb/trunk/source/Utility/StringList.cpp (original)
+++ lldb/trunk/source/Utility/StringList.cpp Mon Aug 19 00:22:19 2019
@@ -61,6 +61,7 @@ void StringList::AppendList(const char *
}
void StringList::AppendList(StringList strings) {
+ m_strings.reserve(m_strings.size() + strings.GetSize());
m_strings.insert(m_strings.end(), strings.begin(), strings.end());
}
Modified: lldb/trunk/unittests/Utility/StringListTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/StringListTest.cpp?rev=369237&r1=369236&r2=369237&view=diff
==============================================================================
--- lldb/trunk/unittests/Utility/StringListTest.cpp (original)
+++ lldb/trunk/unittests/Utility/StringListTest.cpp Mon Aug 19 00:22:19 2019
@@ -512,7 +512,7 @@ TEST(StringListTest, ForRangeEmpty) {
FAIL() << "Shouldn't have hit an element in for range" << e;
}
-TEST(StringListTest, ForRangeSingle) {
+TEST(StringListTest, ForRange) {
StringList s;
s.AppendString("a");
s.AppendString("b");
More information about the lldb-commits
mailing list