The "desired result type" code in the expression
parser has hitherto been an implementation waiting
for a use.  I have now tied the '-o' option for
the expression command -- which indicates that the
result is an Objective-C object and needs to be
printed -- to the ExpressionParser, which
communicates the desired type to Clang.

Now, if the result of an expression is determined
by an Objective-C method call for which there is
no type information, that result is implicitly
cast to id if and only if the -o option is passed
to the expression command.  (Otherwise if there
is no explicit cast Clang will issue an error.
This behavior is identical to what happened before
r146756.)

Also added a testcase for -o enabled and disabled.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@147099 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Interpreter/CommandInterpreter.cpp b/source/Interpreter/CommandInterpreter.cpp
index bce32be..77cab23 100644
--- a/source/Interpreter/CommandInterpreter.cpp
+++ b/source/Interpreter/CommandInterpreter.cpp
@@ -1112,13 +1112,16 @@
                     target = Host::GetDummyTarget(GetDebugger()).get();
                 if (target)
                 {
+                    const bool coerce_to_id = false;
                     const bool unwind_on_error = true;
                     const bool keep_in_memory = false;
                     ValueObjectSP expr_result_valobj_sp;
                     ExecutionResults expr_result = target->EvaluateExpression (expr_str.c_str(), 
                                                                                m_exe_ctx.GetFramePtr(), 
                                                                                eExecutionPolicyOnlyWhenNeeded,
-                                                                               unwind_on_error, keep_in_memory, 
+                                                                               coerce_to_id,
+                                                                               unwind_on_error, 
+                                                                               keep_in_memory, 
                                                                                eNoDynamicValues, 
                                                                                expr_result_valobj_sp);
                     if (expr_result == eExecutionCompleted)