summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/StringList.cpp
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2012-05-26 00:32:39 +0000
committerJohnny Chen <johnny.chen@apple.com>2012-05-26 00:32:39 +0000
commitca7835c685ca98909666ae8094737163a6f8734b (patch)
tree318e3c0f06e664b3930c3bc4c56ac392480a08a4 /lldb/source/Core/StringList.cpp
parentde22182b339a8746221ab09f67f1b39b5912e109 (diff)
downloadbcm5719-llvm-ca7835c685ca98909666ae8094737163a6f8734b.tar.gz
bcm5719-llvm-ca7835c685ca98909666ae8094737163a6f8734b.zip
rdar://problem/11535045
Make 'help arch' return the list of supported architectures. Add a convenience method StringList::Join(const char *separator) which is called from the help function for 'arch'. Also add a simple test case. llvm-svn: 157507
Diffstat (limited to 'lldb/source/Core/StringList.cpp')
-rw-r--r--lldb/source/Core/StringList.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/lldb/source/Core/StringList.cpp b/lldb/source/Core/StringList.cpp
index 1df8b7b9a64..88dd2edb3f8 100644
--- a/lldb/source/Core/StringList.cpp
+++ b/lldb/source/Core/StringList.cpp
@@ -95,6 +95,25 @@ StringList::GetStringAtIndex (size_t idx) const
return NULL;
}
+const char *
+StringList::Join (const char *separator)
+{
+ uint32_t size = GetSize();
+ if (size == 0)
+ return "";
+ if (size == 1)
+ return GetStringAtIndex(0);
+
+ std::string buf;
+ for (uint32_t i = 0; i < size; ++i)
+ {
+ if (i > 0)
+ buf.append(separator);
+ buf.append(GetStringAtIndex(i));
+ }
+ return buf.c_str();;
+}
+
void
StringList::Clear ()
{
OpenPOWER on IntegriCloud