summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression/ASTResultSynthesizer.cpp
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2011-08-04 21:37:47 +0000
committerSean Callanan <scallanan@apple.com>2011-08-04 21:37:47 +0000
commit0c4d8d25a71b06a4402ade3546a8b4e81e7691d1 (patch)
treeb5a7191a69cc078a87ec4a51de6bbf7bb19c49b7 /lldb/source/Expression/ASTResultSynthesizer.cpp
parent6a868441612b2ac607b63dc95f2710c400fbc54c (diff)
downloadbcm5719-llvm-0c4d8d25a71b06a4402ade3546a8b4e81e7691d1.tar.gz
bcm5719-llvm-0c4d8d25a71b06a4402ade3546a8b4e81e7691d1.zip
Fixed a problem that caused LLDB to fail to execute
expressions that used function pointers. The problem was that IRForTarget previously only scanned the IR for the expression for call instructions; if a function was used in another context, it was ignored. Now LLDB scans the Module for functions that are only declared (not also defined -- so these are externals); it then constructs function pointers for these functions and substitutes them wherever the function is used. Also made some changes so that "expr main" works just as well as "expr &main"; they end up being the same code, but LLDB was generating the result variable in different ways. llvm-svn: 136928
Diffstat (limited to 'lldb/source/Expression/ASTResultSynthesizer.cpp')
-rw-r--r--lldb/source/Expression/ASTResultSynthesizer.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/lldb/source/Expression/ASTResultSynthesizer.cpp b/lldb/source/Expression/ASTResultSynthesizer.cpp
index e4c1aa6c2f0..1125d6272f9 100644
--- a/lldb/source/Expression/ASTResultSynthesizer.cpp
+++ b/lldb/source/Expression/ASTResultSynthesizer.cpp
@@ -311,7 +311,12 @@ ASTResultSynthesizer::SynthesizeBodyResult (CompoundStmt *Body,
if (is_lvalue)
{
- IdentifierInfo &result_ptr_id = Ctx.Idents.get("$__lldb_expr_result_ptr");
+ IdentifierInfo *result_ptr_id;
+
+ if (expr_type->isFunctionType())
+ result_ptr_id = &Ctx.Idents.get("$__lldb_expr_result"); // functions actually should be treated like function pointers
+ else
+ result_ptr_id = &Ctx.Idents.get("$__lldb_expr_result_ptr");
QualType ptr_qual_type = Ctx.getPointerType(expr_qual_type);
@@ -319,7 +324,7 @@ ASTResultSynthesizer::SynthesizeBodyResult (CompoundStmt *Body,
DC,
SourceLocation(),
SourceLocation(),
- &result_ptr_id,
+ result_ptr_id,
ptr_qual_type,
NULL,
SC_Static,
OpenPOWER on IntegriCloud