forked from OSchip/llvm-project
Got namespace lookup working and was able to print a complex "this" as an
expression. This currently takes waaaayyyyy too much time to evaluate. We will need to look at the expression parser and find ways to optimize the info we provide and get this to evaluate quicker. I believe the performance issue is currently related to us always providing a complete C++ class type when asked about a C++ class which can cause a lot of information to be pulled since all classes will be fully created (methods, base classes, members, all their types). We will need to give the classes back the parser and mark them as having external sources and get parser (Sema) to query us when it needs more info. This should bring things up to an acceptable level. llvm-svn: 118979
This commit is contained in:
parent
748736d9da
commit
580c5dacd0
|
@ -10,6 +10,8 @@
|
|||
#ifndef liblldb_ClangASTSource_h_
|
||||
#define liblldb_ClangASTSource_h_
|
||||
|
||||
#include <set>
|
||||
|
||||
#include "clang/Basic/IdentifierTable.h"
|
||||
#include "clang/Sema/ExternalSemaSource.h"
|
||||
|
||||
|
@ -44,8 +46,9 @@ public:
|
|||
//------------------------------------------------------------------
|
||||
ClangASTSource(clang::ASTContext &context,
|
||||
ClangExpressionDeclMap &decl_map) :
|
||||
m_ast_context(context),
|
||||
m_decl_map(decl_map)
|
||||
m_ast_context (context),
|
||||
m_decl_map (decl_map),
|
||||
m_active_lookups ()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -119,6 +122,7 @@ protected:
|
|||
|
||||
clang::ASTContext &m_ast_context; ///< The parser's AST context, for copying types into
|
||||
ClangExpressionDeclMap &m_decl_map; ///< The object that looks up named entities in LLDB
|
||||
std::set<const char *> m_active_lookups;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -90,12 +90,21 @@ DeclContext::lookup_result ClangASTSource::FindExternalVisibleDeclsByName
|
|||
}
|
||||
}
|
||||
|
||||
llvm::SmallVector<NamedDecl*, 4> name_decls;
|
||||
|
||||
NameSearchContext name_search_context(*this, name_decls, clang_decl_name, decl_ctx);
|
||||
ConstString const_decl_name(decl_name.c_str());
|
||||
|
||||
const char *uniqued_const_decl_name = const_decl_name.GetCString();
|
||||
if (m_active_lookups.find (uniqued_const_decl_name) != m_active_lookups.end())
|
||||
{
|
||||
// We are currently looking up this name...
|
||||
return DeclContext::lookup_result();
|
||||
}
|
||||
m_active_lookups.insert(uniqued_const_decl_name);
|
||||
llvm::SmallVector<NamedDecl*, 4> name_decls;
|
||||
NameSearchContext name_search_context(*this, name_decls, clang_decl_name, decl_ctx);
|
||||
m_decl_map.GetDecls(name_search_context, const_decl_name);
|
||||
return SetExternalVisibleDeclsForName (decl_ctx, clang_decl_name, name_decls);
|
||||
DeclContext::lookup_result result (SetExternalVisibleDeclsForName (decl_ctx, clang_decl_name, name_decls));
|
||||
m_active_lookups.erase (uniqued_const_decl_name);
|
||||
return result;
|
||||
}
|
||||
|
||||
void ClangASTSource::MaterializeVisibleDecls(const DeclContext *DC)
|
||||
|
|
|
@ -1024,13 +1024,13 @@ ClangExpressionDeclMap::GetDecls (NameSearchContext &context, const ConstString
|
|||
ClangNamespaceDecl namespace_decl (m_sym_ctx.FindNamespace(name));
|
||||
if (namespace_decl)
|
||||
{
|
||||
// clang::NamespaceDecl *clang_namespace_decl = AddNamespace(context, namespace_decl);
|
||||
// if (clang_namespace_decl)
|
||||
// {
|
||||
// // TODO: is this how we get the decl lookups to be called for
|
||||
// // this namespace??
|
||||
// clang_namespace_decl->setHasExternalLexicalStorage();
|
||||
// }
|
||||
clang::NamespaceDecl *clang_namespace_decl = AddNamespace(context, namespace_decl);
|
||||
if (clang_namespace_decl)
|
||||
{
|
||||
// TODO: is this how we get the decl lookups to be called for
|
||||
// this namespace??
|
||||
clang_namespace_decl->setHasExternalLexicalStorage();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue