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.

llvm-svn: 113789
This commit is contained in:
Sean Callanan
2010-09-13 21:34:21 +00:00
parent 535e8e5f60
commit 9e6ed53ea5
15 changed files with 410 additions and 57 deletions

View File

@@ -219,7 +219,7 @@ CommandObjectExpression::EvaluateExpression (const char *expr, bool bare, Stream
return false;
}
ClangExpressionVariable *expr_result;
ClangExpressionVariable *expr_result = NULL;
if (!user_expression.Execute (error_stream, m_exe_ctx, expr_result))
{
@@ -249,7 +249,6 @@ CommandObjectExpression::EvaluateExpression (const char *expr, bool bare, Stream
}
else
{
error_stream.Printf ("Expression produced no result\n");
if (result)
result->SetStatus (eReturnStatusSuccessFinishNoResult);
}