diff options
author | Johnny Chen <johnny.chen@apple.com> | 2012-05-26 00:32:39 +0000 |
---|---|---|
committer | Johnny Chen <johnny.chen@apple.com> | 2012-05-26 00:32:39 +0000 |
commit | ca7835c685ca98909666ae8094737163a6f8734b (patch) | |
tree | 318e3c0f06e664b3930c3bc4c56ac392480a08a4 /lldb/source/Core/StringList.cpp | |
parent | de22182b339a8746221ab09f67f1b39b5912e109 (diff) | |
download | bcm5719-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.cpp | 19 |
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 () { |