Bugfixes to the expression parser.  Fixes include:

 - If you put a semicolon at the end of an expression,
   this no longer causes the expression parser to
   error out.  This was a two-part fix: first,
   ClangExpressionDeclMap::Materialize now handles
   an empty struct (such as when there is no return
   value); second, ASTResultSynthesizer walks backward
   from the end of the ASTs until it reaches something
   that's not a NullStmt.

 - ClangExpressionVariable now properly byte-swaps when
   printing itself.

 - ClangUtilityFunction now cleans up after itself when
   it's done compiling itself.

 - Utility functions can now use external functions just
   like user expressions.

 - If you end your expression with a statement that does
   not return a value, the expression now runs correctly
   anyway.

Also, added the beginnings of an Objective-C object
validator function, which is neither installed nor used
as yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113789 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/ClangExpressionParser.cpp b/source/Expression/ClangExpressionParser.cpp
index 1bc8866..f8b71ed 100644
--- a/source/Expression/ClangExpressionParser.cpp
+++ b/source/Expression/ClangExpressionParser.cpp
@@ -403,7 +403,10 @@
         
         std::auto_ptr<llvm::TargetMachine> target_machine(target->createTargetMachine(m_target_triple, ""));
         
-        IRForTarget ir_for_target(decl_map, target_machine->getTargetData(), m_expr.FunctionName());
+        IRForTarget ir_for_target(decl_map, 
+                                  target_machine->getTargetData(),
+                                  m_expr.NeedsVariableResolution(),
+                                  m_expr.FunctionName());
         
         if (!ir_for_target.runOnModule(*module))
         {
@@ -412,14 +415,17 @@
             return err;
         }
         
-        IRDynamicChecks ir_dynamic_checks(*exe_ctx.process->GetDynamicCheckers(), m_expr.FunctionName());
-        
-        if (!ir_dynamic_checks.runOnModule(*module))
+        if (m_expr.NeedsValidation())
         {
-            err.SetErrorToGenericError();
-            err.SetErrorString("Couldn't add dynamic checks to the expression");
-            return err;
-        }        
+            IRDynamicChecks ir_dynamic_checks(*exe_ctx.process->GetDynamicCheckers(), m_expr.FunctionName());
+        
+            if (!ir_dynamic_checks.runOnModule(*module))
+            {
+                err.SetErrorToGenericError();
+                err.SetErrorString("Couldn't add dynamic checks to the expression");
+                return err;
+            }
+        }
     }
     
     m_jit_mm = new RecordingMemoryManager();