diff options
| author | Greg Clayton <gclayton@apple.com> | 2012-07-14 00:53:55 +0000 |
|---|---|---|
| committer | Greg Clayton <gclayton@apple.com> | 2012-07-14 00:53:55 +0000 |
| commit | 685c88c5a8d86d10b0b9077a76b22815ce092f27 (patch) | |
| tree | e341c3c30fdde248b865150b22362e488e44212c /lldb/source/Symbol/SymbolContext.cpp | |
| parent | c22e8d11929a3107c11ddf368078238cfd6a4416 (diff) | |
| download | bcm5719-llvm-685c88c5a8d86d10b0b9077a76b22815ce092f27.tar.gz bcm5719-llvm-685c88c5a8d86d10b0b9077a76b22815ce092f27.zip | |
<rdar://problem/11870357>
Allow "frame variable" to find ivars without the need for "this->" or "self->".
llvm-svn: 160211
Diffstat (limited to 'lldb/source/Symbol/SymbolContext.cpp')
| -rw-r--r-- | lldb/source/Symbol/SymbolContext.cpp | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp index 4291b0c7197..b2bb97fd30b 100644 --- a/lldb/source/Symbol/SymbolContext.cpp +++ b/lldb/source/Symbol/SymbolContext.cpp @@ -13,6 +13,8 @@ #include "lldb/Core/Module.h" #include "lldb/Host/Host.h" #include "lldb/Interpreter/Args.h" +#include "lldb/Symbol/Block.h" +#include "lldb/Symbol/ClangASTContext.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/Symbol.h" @@ -535,7 +537,61 @@ SymbolContext::GetParentOfInlinedScope (const Address &curr_frame_pc, return false; } -ConstString +Block * +SymbolContext::GetFunctionBlock () +{ + if (function) + { + if (block) + { + // If this symbol context has a block, check to see if this block + // is itself, or is contained within a block with inlined function + // information. If so, then the inlined block is the block that + // defines the function. + Block *inlined_block = block->GetContainingInlinedBlock(); + if (inlined_block) + return inlined_block; + + // The block in this symbol context is not inside an inlined + // block, so the block that defines the function is the function's + // top level block, which is returned below. + } + + // There is no block information in this symbol context, so we must + // assume that the block that is desired is the top level block of + // the function itself. + return &function->GetBlock(true); + } + return NULL; +} + +bool +SymbolContext::GetFunctionMethodInfo (lldb::LanguageType &language, + bool &is_instance_method, + ConstString &language_object_name) + + +{ + Block *function_block = GetFunctionBlock (); + if (function_block) + { + clang::DeclContext *decl_context = function_block->GetClangDeclContext(); + + if (decl_context) + { + return ClangASTContext::GetClassMethodInfoForDeclContext (decl_context, + language, + is_instance_method, + language_object_name); + } + } + language = eLanguageTypeUnknown; + is_instance_method = false; + language_object_name.Clear(); + return false; +} + +ConstString SymbolContext::GetFunctionName (Mangled::NamePreference preference) { if (function) |

