summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression/ClangUtilityFunction.cpp
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2010-09-13 21:34:21 +0000
committerSean Callanan <scallanan@apple.com>2010-09-13 21:34:21 +0000
commit9e6ed53ea51e66688dcf4d30837c6fbe4ec06f1e (patch)
treec820006abd28b091188967ad931adb82ccf42b40 /lldb/source/Expression/ClangUtilityFunction.cpp
parent535e8e5f6004865b6c3f1df3ddc603d57d2311b8 (diff)
downloadbcm5719-llvm-9e6ed53ea51e66688dcf4d30837c6fbe4ec06f1e.tar.gz
bcm5719-llvm-9e6ed53ea51e66688dcf4d30837c6fbe4ec06f1e.zip
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
Diffstat (limited to 'lldb/source/Expression/ClangUtilityFunction.cpp')
-rw-r--r--lldb/source/Expression/ClangUtilityFunction.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lldb/source/Expression/ClangUtilityFunction.cpp b/lldb/source/Expression/ClangUtilityFunction.cpp
index 17ba7dba331..310cac9d571 100644
--- a/lldb/source/Expression/ClangUtilityFunction.cpp
+++ b/lldb/source/Expression/ClangUtilityFunction.cpp
@@ -17,6 +17,7 @@
#include "lldb/Core/ConstString.h"
#include "lldb/Core/Stream.h"
+#include "lldb/Expression/ClangExpressionDeclMap.h"
#include "lldb/Expression/ClangExpressionParser.h"
#include "lldb/Expression/ClangUtilityFunction.h"
#include "lldb/Host/Host.h"
@@ -93,6 +94,8 @@ ClangUtilityFunction::Install (Stream &error_stream,
//////////////////////////
// Parse the expression
//
+
+ m_expr_decl_map.reset(new ClangExpressionDeclMap(&exe_ctx));
ClangExpressionParser parser(target_triple.GetCString(), *this);
@@ -101,6 +104,9 @@ ClangUtilityFunction::Install (Stream &error_stream,
if (num_errors)
{
error_stream.Printf ("error: %d errors parsing expression\n", num_errors);
+
+ m_expr_decl_map.reset();
+
return false;
}
@@ -110,6 +116,8 @@ ClangUtilityFunction::Install (Stream &error_stream,
Error jit_error = parser.MakeJIT (m_jit_begin, m_jit_end, exe_ctx);
+ m_expr_decl_map.reset();
+
if (jit_error.Success())
{
return true;
OpenPOWER on IntegriCloud