Made expressions that are just casts of pointer 
variables be evaluated statically.

Also fixed a bug that caused the results of
statically-evaluated expressions to be materialized
improperly.

This bug also removes some duplicate code.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131042 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/ClangExpressionParser.cpp b/source/Expression/ClangExpressionParser.cpp
index 0d693ce..5165462 100644
--- a/source/Expression/ClangExpressionParser.cpp
+++ b/source/Expression/ClangExpressionParser.cpp
@@ -456,7 +456,8 @@
                                 lldb::addr_t &func_addr, 
                                 lldb::addr_t &func_end, 
                                 ExecutionContext &exe_ctx,
-                                lldb::ClangExpressionVariableSP *const_result)
+                                lldb::ClangExpressionVariableSP &const_result,
+                                bool jit_only_if_needed)
 {
     func_allocation_addr = LLDB_INVALID_ADDRESS;
 	func_addr = LLDB_INVALID_ADDRESS;
@@ -512,6 +513,12 @@
             return err;
         }
         
+        if (jit_only_if_needed && const_result.get())
+        {
+            err.Clear();
+            return err;
+        }
+        
         if (m_expr.NeedsValidation() && exe_ctx.process->GetDynamicCheckers())
         {
             IRDynamicChecks ir_dynamic_checks(*exe_ctx.process->GetDynamicCheckers(), function_name.c_str());