Don't limit StreamTee to just two streams. It now can contain
N streams by making the stream a vector of stream shared pointers
that is protected by a mutex. Streams can be get/set by index which
allows indexes to be defined as stream indentifiers. If a stream is
set at index 3 and there are now streams in the collection, then
empty stream objects are inserted to ensure that stream at index 3
has a valid stream. There is also an append method that allows a stream
to be pushed onto the stack. This will allow our streams to be very
flexible in where the output goes.

Modified the CommandReturnObject to use the new StreamTee functionality.
This class now defines two StreamTee indexes: 0 for the stream string
stream, and 1 for the immediate stream. This is used both on the output
and error streams.

Added the ability to get argument types as strings or as descriptions.
This is exported through the SBCommandInterpreter API to allow external
access.

Modified the Driver class to use the newly exported argument names from
SBCommandInterpreter::GetArgumentTypeAsCString().



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@126067 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/driver/Driver.cpp b/tools/driver/Driver.cpp
index 04e69e4..3ec2c2f 100644
--- a/tools/driver/Driver.cpp
+++ b/tools/driver/Driver.cpp
@@ -181,35 +181,6 @@
     }
 }
 
-void 
-GetArgumentName (const CommandArgumentType arg_type, std::string &arg_name)
-{
-    //Fudge this function here, since we can't call the "real" version in lldb_private::CommandObject...
-
-    switch (arg_type)
-    {
-        // Make cases for all the arg_types used in Driver.cpp
-
-        case eArgTypeNone:
-            arg_name = "";
-            break;
-
-        case eArgTypeArchitecture:
-            arg_name = "architecture";
-            break;
-    
-        case eArgTypeScriptLang:
-            arg_name = "script-language";
-            break;
-
-        case eArgTypeFilename:
-            arg_name = "filename";
-            break;
-    }
-    return;
-}
-
-
 void
 ShowUsage (FILE *out, lldb::OptionDefinition *option_table, Driver::OptionData data)
 {
@@ -265,23 +236,22 @@
             if (option_table[i].usage_mask & opt_set_mask)
             {
                 CommandArgumentType arg_type = option_table[i].argument_type;
-                std::string arg_name;
-                GetArgumentName (arg_type, arg_name);
+                const char *arg_name = SBCommandInterpreter::GetArgumentTypeAsCString (arg_type);
                 if (option_table[i].required)
                 {
                     if (option_table[i].option_has_arg == required_argument)
-                        fprintf (out, " -%c <%s>", option_table[i].short_option, arg_name.c_str());
+                        fprintf (out, " -%c <%s>", option_table[i].short_option, arg_name);
                     else if (option_table[i].option_has_arg == optional_argument)
-                        fprintf (out, " -%c [<%s>]", option_table[i].short_option, arg_name.c_str());
+                        fprintf (out, " -%c [<%s>]", option_table[i].short_option, arg_name);
                     else
                         fprintf (out, " -%c", option_table[i].short_option);
                 }
                 else
                 {
                     if (option_table[i].option_has_arg == required_argument)
-                        fprintf (out, " [-%c <%s>]", option_table[i].short_option, arg_name.c_str());
+                        fprintf (out, " [-%c <%s>]", option_table[i].short_option, arg_name);
                     else if (option_table[i].option_has_arg == optional_argument)
-                        fprintf (out, " [-%c [<%s>]]", option_table[i].short_option, arg_name.c_str());
+                        fprintf (out, " [-%c [<%s>]]", option_table[i].short_option, arg_name);
                     else
                         fprintf (out, " [-%c]", option_table[i].short_option);
                 }
@@ -311,17 +281,16 @@
         if (pos == options_seen.end())
         {
             CommandArgumentType arg_type = option_table[i].argument_type;
-            std::string arg_name;
-            GetArgumentName (arg_type, arg_name);
+            const char *arg_name = SBCommandInterpreter::GetArgumentTypeAsCString (arg_type);
 
             options_seen.insert (option_table[i].short_option);
             fprintf (out, "%*s-%c ", indent_level, "", option_table[i].short_option);
             if (arg_type != eArgTypeNone)
-                fprintf (out, "<%s>", arg_name.c_str());
+                fprintf (out, "<%s>", arg_name);
             fprintf (out, "\n");
             fprintf (out, "%*s--%s ", indent_level, "", option_table[i].long_option);
             if (arg_type != eArgTypeNone)
-                fprintf (out, "<%s>", arg_name.c_str());
+                fprintf (out, "<%s>", arg_name);
             fprintf (out, "\n");
             indent_level += 5;
             OutputFormattedUsageText (out, indent_level, option_table[i].usage_text, screen_width);