summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Expression')
-rw-r--r--lldb/source/Expression/ClangASTSource.cpp77
-rw-r--r--lldb/source/Expression/ClangExpressionDeclMap.cpp34
2 files changed, 61 insertions, 50 deletions
diff --git a/lldb/source/Expression/ClangASTSource.cpp b/lldb/source/Expression/ClangASTSource.cpp
index 34103a6a653..3ef9e757965 100644
--- a/lldb/source/Expression/ClangASTSource.cpp
+++ b/lldb/source/Expression/ClangASTSource.cpp
@@ -17,34 +17,34 @@
using namespace clang;
using namespace lldb_private;
-ClangASTSource::~ClangASTSource() {}
+ClangASTSource::~ClangASTSource()
+{
+}
-void ClangASTSource::StartTranslationUnit(ASTConsumer *Consumer) {
+void
+ClangASTSource::StartTranslationUnit(ASTConsumer *Consumer)
+{
// Tell Sema to ask us when looking into the translation unit's decl.
m_ast_context.getTranslationUnitDecl()->setHasExternalVisibleStorage();
m_ast_context.getTranslationUnitDecl()->setHasExternalLexicalStorage();
}
-// These are only required for AST source that want to lazily load
-// the declarations (or parts thereof) that they return.
-Decl *ClangASTSource::GetExternalDecl(uint32_t) { return 0; }
-Stmt *ClangASTSource::GetExternalDeclStmt(uint64_t) { return 0; }
-
-// These are also optional, although it might help with ObjC
-// debugging if we have respectable signatures. But a more
-// efficient interface (that didn't require scanning all files
-// for method signatures!) might help.
-Selector ClangASTSource::GetExternalSelector(uint32_t) { return Selector(); }
-uint32_t ClangASTSource::GetNumExternalSelectors() { return 0; }
-CXXBaseSpecifier *ClangASTSource::GetExternalCXXBaseSpecifiers(uint64_t Offset) { return NULL; }
-
// The core lookup interface.
-DeclContext::lookup_result ClangASTSource::FindExternalVisibleDeclsByName
+DeclContext::lookup_result
+ClangASTSource::FindExternalVisibleDeclsByName
(
const DeclContext *decl_ctx,
DeclarationName clang_decl_name
)
{
+ if (m_decl_map.GetImportInProgress())
+ return SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+
+ std::string decl_name (clang_decl_name.getAsString());
+
+// if (m_decl_map.DoingASTImport ())
+// return DeclContext::lookup_result();
+//
switch (clang_decl_name.getNameKind()) {
// Normal identifiers.
case DeclarationName::Identifier:
@@ -75,7 +75,6 @@ DeclContext::lookup_result ClangASTSource::FindExternalVisibleDeclsByName
return DeclContext::lookup_result();
}
- std::string decl_name (clang_decl_name.getAsString());
if (!m_decl_map.GetLookupsEnabled())
{
@@ -112,25 +111,47 @@ DeclContext::lookup_result ClangASTSource::FindExternalVisibleDeclsByName
return result;
}
-void ClangASTSource::MaterializeVisibleDecls(const DeclContext *DC)
+void
+ClangASTSource::CompleteType (TagDecl *tag_decl)
+{
+ puts(__PRETTY_FUNCTION__);
+}
+
+void
+ClangASTSource::CompleteType (ObjCInterfaceDecl *objc_decl)
+{
+ puts(__PRETTY_FUNCTION__);
+}
+
+void
+ClangASTSource::MaterializeVisibleDecls(const DeclContext *DC)
{
return;
}
// This is used to support iterating through an entire lexical context,
// which isn't something the debugger should ever need to do.
-bool ClangASTSource::FindExternalLexicalDecls(const DeclContext *DC,
- bool (*isKindWeWant)(Decl::Kind),
- llvm::SmallVectorImpl<Decl*> &Decls) {
+bool
+ClangASTSource::FindExternalLexicalDecls
+(
+ const DeclContext *DC,
+ bool (*isKindWeWant)(Decl::Kind),
+ llvm::SmallVectorImpl<Decl*> &Decls
+)
+{
// true is for error, that's good enough for me
return true;
}
-clang::ASTContext *NameSearchContext::GetASTContext() {
+clang::ASTContext *
+NameSearchContext::GetASTContext()
+{
return &m_ast_source.m_ast_context;
}
-clang::NamedDecl *NameSearchContext::AddVarDecl(void *type) {
+clang::NamedDecl *
+NameSearchContext::AddVarDecl(void *type)
+{
IdentifierInfo *ii = m_decl_name.getAsIdentifierInfo();
assert (type && "Type for variable must be non-NULL!");
@@ -148,7 +169,9 @@ clang::NamedDecl *NameSearchContext::AddVarDecl(void *type) {
return Decl;
}
-clang::NamedDecl *NameSearchContext::AddFunDecl (void *type) {
+clang::NamedDecl *
+NameSearchContext::AddFunDecl (void *type)
+{
clang::FunctionDecl *func_decl = FunctionDecl::Create (m_ast_source.m_ast_context,
const_cast<DeclContext*>(m_decl_context),
SourceLocation(),
@@ -199,7 +222,8 @@ clang::NamedDecl *NameSearchContext::AddFunDecl (void *type) {
return func_decl;
}
-clang::NamedDecl *NameSearchContext::AddGenericFunDecl()
+clang::NamedDecl *
+NameSearchContext::AddGenericFunDecl()
{
QualType generic_function_type(m_ast_source.m_ast_context.getFunctionType (m_ast_source.m_ast_context.getSizeType(), // result
NULL, // argument types
@@ -215,7 +239,8 @@ clang::NamedDecl *NameSearchContext::AddGenericFunDecl()
return AddFunDecl(generic_function_type.getAsOpaquePtr());
}
-clang::NamedDecl *NameSearchContext::AddTypeDecl(void *type)
+clang::NamedDecl *
+NameSearchContext::AddTypeDecl(void *type)
{
QualType qual_type = QualType::getFromOpaquePtr(type);
diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp
index 854524c1bce..08468faf1fd 100644
--- a/lldb/source/Expression/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp
@@ -1711,8 +1711,8 @@ ClangExpressionDeclMap::GetDecls (NameSearchContext &context, const ConstString
log->PutCString (strm.GetData());
}
- TypeFromUser user_type(type_sp->GetClangType(),
- type_sp->GetClangAST());
+ TypeFromUser user_type (type_sp->GetClangType(),
+ type_sp->GetClangAST());
AddOneType(context, user_type, false);
}
@@ -1748,18 +1748,9 @@ ClangExpressionDeclMap::GetVariableValue
return NULL;
}
- TypeList *type_list = var_type->GetTypeList();
+ clang::ASTContext *ast = var_type->GetClangASTContext().getASTContext();
- if (!type_list)
- {
- if (log)
- log->PutCString("Skipped a definition because the type has no associated type list");
- return NULL;
- }
-
- clang::ASTContext *exe_ast_ctx = type_list->GetClangASTContext().getASTContext();
-
- if (!exe_ast_ctx)
+ if (!ast)
{
if (log)
log->PutCString("There is no AST context for the current execution context");
@@ -1780,20 +1771,18 @@ ClangExpressionDeclMap::GetVariableValue
}
Error err;
- if (!var_location_expr.Evaluate(&exe_ctx, exe_ast_ctx, NULL, loclist_base_load_addr, NULL, *var_location.get(), &err))
+ if (!var_location_expr.Evaluate(&exe_ctx, ast, NULL, loclist_base_load_addr, NULL, *var_location.get(), &err))
{
if (log)
log->Printf("Error evaluating location: %s", err.AsCString());
return NULL;
}
-
- clang::ASTContext *var_ast_context = type_list->GetClangASTContext().getASTContext();
-
+
void *type_to_use;
if (parser_ast_context)
{
- type_to_use = GuardedCopyType(parser_ast_context, var_ast_context, var_opaque_type);
+ type_to_use = GuardedCopyType(parser_ast_context, ast, var_opaque_type);
if (!type_to_use)
{
@@ -1834,14 +1823,13 @@ ClangExpressionDeclMap::GetVariableValue
}
if (user_type)
- *user_type = TypeFromUser(var_opaque_type, var_ast_context);
+ *user_type = TypeFromUser(var_opaque_type, ast);
return var_location.release();
}
void
-ClangExpressionDeclMap::AddOneVariable(NameSearchContext &context,
- Variable* var)
+ClangExpressionDeclMap::AddOneVariable (NameSearchContext &context, Variable* var)
{
assert (m_parser_vars.get());
@@ -1965,7 +1953,6 @@ ClangExpressionDeclMap::AddNamespace (NameSearchContext &context, const ClangNam
{
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
-
clang::Decl *copied_decl = ClangASTContext::CopyDecl (context.GetASTContext(),
namespace_decl.GetASTContext(),
namespace_decl.GetNamespaceDecl());
@@ -2012,8 +1999,7 @@ ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context,
fun_address = &fun->GetAddressRange().GetBaseAddress();
- TypeList *type_list = fun_type->GetTypeList();
- fun_ast_context = type_list->GetClangASTContext().getASTContext();
+ fun_ast_context = fun_type->GetClangASTContext().getASTContext();
void *copied_type = GuardedCopyType(context.GetASTContext(), fun_ast_context, fun_opaque_type);
fun_decl = context.AddFunDecl(copied_type);
OpenPOWER on IntegriCloud