summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2019-08-19 07:22:19 +0000
committerRaphael Isemann <teemperor@gmail.com>2019-08-19 07:22:19 +0000
commit21599876be328ff6b5c6cf09544ade7e337cb48d (patch)
tree5e771ac0d6eea93873c27a08bff14f01b004c31a
parentb1752f670f3d6393306dd5d37546b6e23384d8a2 (diff)
downloadbcm5719-llvm-21599876be328ff6b5c6cf09544ade7e337cb48d.tar.gz
bcm5719-llvm-21599876be328ff6b5c6cf09544ade7e337cb48d.zip
[lldb][NFC] Address review comments to StringList for-loop support
llvm-svn: 369237
-rw-r--r--lldb/include/lldb/Utility/StringList.h8
-rw-r--r--lldb/source/Commands/CommandObjectType.cpp5
-rw-r--r--lldb/source/Utility/StringList.cpp1
-rw-r--r--lldb/unittests/Utility/StringListTest.cpp2
4 files changed, 8 insertions, 8 deletions
diff --git a/lldb/include/lldb/Utility/StringList.h b/lldb/include/lldb/Utility/StringList.h
index 1c70d398550..6d7474e4fc5 100644
--- a/lldb/include/lldb/Utility/StringList.h
+++ b/lldb/include/lldb/Utility/StringList.h
@@ -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
diff --git a/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp
index f5d82a26249..cbe0e37824c 100644
--- a/lldb/source/Commands/CommandObjectType.cpp
+++ b/lldb/source/Commands/CommandObjectType.cpp
@@ -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,
diff --git a/lldb/source/Utility/StringList.cpp b/lldb/source/Utility/StringList.cpp
index c242ccafa38..f570c3272f2 100644
--- a/lldb/source/Utility/StringList.cpp
+++ b/lldb/source/Utility/StringList.cpp
@@ -61,6 +61,7 @@ void StringList::AppendList(const char **strv, int strc) {
}
void StringList::AppendList(StringList strings) {
+ m_strings.reserve(m_strings.size() + strings.GetSize());
m_strings.insert(m_strings.end(), strings.begin(), strings.end());
}
diff --git a/lldb/unittests/Utility/StringListTest.cpp b/lldb/unittests/Utility/StringListTest.cpp
index 264ec92d42e..926f75fb4f3 100644
--- a/lldb/unittests/Utility/StringListTest.cpp
+++ b/lldb/unittests/Utility/StringListTest.cpp
@@ -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");
OpenPOWER on IntegriCloud