diff options
| author | Jim Ingham <jingham@apple.com> | 2012-10-30 23:35:54 +0000 |
|---|---|---|
| committer | Jim Ingham <jingham@apple.com> | 2012-10-30 23:35:54 +0000 |
| commit | 5fdeed4e9f03c15f6282bddf70863028d3336813 (patch) | |
| tree | 216dc1837b7cb8bfbdcd2d0fc238ed332f356695 /lldb/source/Expression/ClangUserExpression.cpp | |
| parent | 2cffda3ff8bb5435e524da975fd43d9cf7d90e59 (diff) | |
| download | bcm5719-llvm-5fdeed4e9f03c15f6282bddf70863028d3336813.tar.gz bcm5719-llvm-5fdeed4e9f03c15f6282bddf70863028d3336813.zip | |
Make blocks that capture their containing method's object pointer look like methods of
the containing class so that direct ivar access will work in the expression parser.
<rdar://problem/9797999>
llvm-svn: 167061
Diffstat (limited to 'lldb/source/Expression/ClangUserExpression.cpp')
| -rw-r--r-- | lldb/source/Expression/ClangUserExpression.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lldb/source/Expression/ClangUserExpression.cpp b/lldb/source/Expression/ClangUserExpression.cpp index 450728272e6..9dfd0998a25 100644 --- a/lldb/source/Expression/ClangUserExpression.cpp +++ b/lldb/source/Expression/ClangUserExpression.cpp @@ -31,6 +31,10 @@ #include "lldb/Expression/ExpressionSourceCode.h" #include "lldb/Host/Host.h" #include "lldb/Symbol/Block.h" +#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/Function.h" +#include "lldb/Symbol/Type.h" +#include "lldb/Symbol/ClangExternalASTSourceCommon.h" #include "lldb/Symbol/VariableList.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Process.h" @@ -192,6 +196,29 @@ ClangUserExpression::ScanContext(ExecutionContext &exe_ctx, Error &err) m_static_method = true; } } + else if (clang::FunctionDecl *function_decl = llvm::dyn_cast<clang::FunctionDecl>(decl_context)) + { + // We might also have a function that said in the debug information that it captured an + // object pointer. The best way to deal with getting to the ivars at present it by pretending + // that this is a method of a class in whatever runtime the debug info says the object pointer + // belongs to. Do that here. + + ClangASTMetadata *metadata = ClangASTContext::GetMetadata (&decl_context->getParentASTContext(), (uintptr_t) function_decl); + if (metadata && metadata->HasObjectPtr()) + { + lldb::LanguageType language = metadata->GetObjectPtrLanguage(); + if (language == lldb::eLanguageTypeC_plus_plus) + { + m_cplusplus = true; + m_needs_object_ptr = true; + } + else if (language == lldb::eLanguageTypeObjC) + { + m_objectivec = true; + m_needs_object_ptr = true; + } + } + } } // This is a really nasty hack, meant to fix Objective-C expressions of the form |

