diff options
| author | Sean Callanan <scallanan@apple.com> | 2011-11-09 19:33:21 +0000 |
|---|---|---|
| committer | Sean Callanan <scallanan@apple.com> | 2011-11-09 19:33:21 +0000 |
| commit | 0730e9c992963c4f880f31ab6d014a2107809a40 (patch) | |
| tree | 94d1e604a686c2bdc25a4be15f9017881647b716 /lldb/source/Expression/ClangASTSource.cpp | |
| parent | 5d9ae5ca23e21d5418c617c26f37741eb38b290c (diff) | |
| download | bcm5719-llvm-0730e9c992963c4f880f31ab6d014a2107809a40.tar.gz bcm5719-llvm-0730e9c992963c4f880f31ab6d014a2107809a40.zip | |
Added a function to ClangASTSource to service
lookups for Objective-C methods by selector.
Right now all it does is print log information.
Also improved the logging for imported TagDecls
to indicate whether or not the definition for
the imported TagDecl is complete.
llvm-svn: 144203
Diffstat (limited to 'lldb/source/Expression/ClangASTSource.cpp')
| -rw-r--r-- | lldb/source/Expression/ClangASTSource.cpp | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/lldb/source/Expression/ClangASTSource.cpp b/lldb/source/Expression/ClangASTSource.cpp index 5252eecf879..8b82a885329 100644 --- a/lldb/source/Expression/ClangASTSource.cpp +++ b/lldb/source/Expression/ClangASTSource.cpp @@ -72,12 +72,18 @@ ClangASTSource::FindExternalVisibleDeclsByName case DeclarationName::CXXUsingDirective: return SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name); - // These aren't looked up like this. case DeclarationName::ObjCZeroArgSelector: case DeclarationName::ObjCOneArgSelector: case DeclarationName::ObjCMultiArgSelector: - return DeclContext::lookup_result(); + { + llvm::SmallVector<NamedDecl*, 1> method_decls; + NameSearchContext method_search_context (*this, method_decls, clang_decl_name, decl_ctx); + + FindObjCMethodDecls(method_search_context); + + return SetExternalVisibleDeclsForName (decl_ctx, clang_decl_name, method_decls); + } // These aren't possible in the global context. case DeclarationName::CXXConstructorName: case DeclarationName::CXXDestructorName: @@ -457,6 +463,46 @@ ClangASTSource::FindExternalVisibleDecls (NameSearchContext &context, } while(0); } +void +ClangASTSource::FindObjCMethodDecls (NameSearchContext &context) +{ + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); + + const DeclarationName &decl_name(context.m_decl_name); + const DeclContext *decl_ctx(context.m_decl_context); + + const ObjCInterfaceDecl *interface_decl = dyn_cast<ObjCInterfaceDecl>(decl_ctx); + + if (!interface_decl) + return; + + StreamString ss; + if (decl_name.isObjCZeroArgSelector()) + { + ss.Printf("%s", decl_name.getAsString().c_str()); + } + else if (decl_name.isObjCOneArgSelector()) + { + ss.Printf("%s:", decl_name.getAsString().c_str()); + } + else + { + clang::Selector sel = decl_name.getObjCSelector(); + + for (unsigned i = 0, e = sel.getNumArgs(); + i != e; + ++i) + { + llvm::StringRef r = sel.getNameForSlot(i); + ss.Printf("%s:", r.str().c_str()); + } + } + ss.Flush(); + + if (log) + log->Printf("ClangASTSource::FindObjCMethodDecls for selector [%s %s]", interface_decl->getNameAsString().c_str(), ss.GetData()); +} + void ClangASTSource::CompleteNamespaceMap (ClangASTImporter::NamespaceMapSP &namespace_map, const ConstString &name, |

