summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression/ClangExpressionDeclMap.cpp
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2010-11-19 20:20:02 +0000
committerSean Callanan <scallanan@apple.com>2010-11-19 20:20:02 +0000
commit6abfabff6158076eccdf6fcac5a12894039de2c9 (patch)
treefb2b0b9fee6a19967b10ab70d94e663de84ddf29 /lldb/source/Expression/ClangExpressionDeclMap.cpp
parent003c6e700b9e240a3b534a36d90c1a6c38f8811d (diff)
downloadbcm5719-llvm-6abfabff6158076eccdf6fcac5a12894039de2c9.tar.gz
bcm5719-llvm-6abfabff6158076eccdf6fcac5a12894039de2c9.zip
Modifications to type handling logic. We no longer
perform recursive type lookups, because these are not required for full type fidelity. We also make the SelectorTable last for the full lifetime of the Clang compiler; this was the source of many bugs. llvm-svn: 119835
Diffstat (limited to 'lldb/source/Expression/ClangExpressionDeclMap.cpp')
-rw-r--r--lldb/source/Expression/ClangExpressionDeclMap.cpp73
1 files changed, 41 insertions, 32 deletions
diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp
index bc861746014..0775b4fea1d 100644
--- a/lldb/source/Expression/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp
@@ -57,7 +57,7 @@ ClangExpressionDeclMap::ClangExpressionDeclMap (ExecutionContext *exe_ctx) :
m_materialized_location (0),
m_result_name (),
m_object_pointer_type (),
- m_lookedup_types ()
+ m_ignore_lookups (false)
{
if (exe_ctx)
{
@@ -990,6 +990,13 @@ ClangExpressionDeclMap::GetDecls (NameSearchContext &context, const ConstString
// Back out in all cases where we're not fully initialized
if (m_exe_ctx.frame == NULL)
return;
+
+ if (m_ignore_lookups)
+ {
+ if (log)
+ log->Printf("Ignoring a query during an import");
+ return;
+ }
SymbolContextList sc_list;
@@ -1117,36 +1124,22 @@ ClangExpressionDeclMap::GetDecls (NameSearchContext &context, const ConstString
AddOneVariable(context, pvar);
}
-
- // See information on gating of this operation next to the definition for
- // m_lookedup_types.
-
- if (m_lookedup_types.find(name_unique_cstr) == m_lookedup_types.end())
- {
- // 1 The name is added to m_lookedup_types.
- m_lookedup_types.insert(std::pair<const char*, bool>(name_unique_cstr, true));
-
- // 2 The type is looked up and added, potentially causing more type loookups.
- lldb::TypeSP type_sp (m_sym_ctx.FindTypeByName (name));
+ lldb::TypeSP type_sp (m_sym_ctx.FindTypeByName (name));
- if (type_sp)
+ if (type_sp)
+ {
+ if (log)
{
- if (log)
- {
- log->Printf ("Matching type found for \"%s\": ", name.GetCString());
- StreamString strm;
- type_sp->Dump(&strm, true);
- log->PutCString (strm.GetData());
- }
+ log->Printf ("Matching type found for \"%s\": ", name.GetCString());
+ StreamString strm;
+ type_sp->Dump(&strm, true);
+ log->PutCString (strm.GetData());
+ }
- TypeFromUser user_type(type_sp->GetClangType(),
+ TypeFromUser user_type(type_sp->GetClangType(),
type_sp->GetClangAST());
- AddOneType(context, user_type, false);
- }
-
- // 3 The name is removed from m_lookedup_types.
- m_lookedup_types.erase(name_unique_cstr);
+ AddOneType(context, user_type, false);
}
}
@@ -1225,7 +1218,7 @@ ClangExpressionDeclMap::GetVariableValue
if (parser_ast_context)
{
- type_to_use = ClangASTContext::CopyType(parser_ast_context, var_ast_context, var_opaque_type);
+ type_to_use = GuardedCopyType(parser_ast_context, var_ast_context, var_opaque_type);
if (parser_type)
*parser_type = TypeFromParser(type_to_use, parser_ast_context);
@@ -1310,9 +1303,9 @@ ClangExpressionDeclMap::AddOneVariable(NameSearchContext &context,
TypeFromUser user_type = pvar->m_user_type;
- TypeFromParser parser_type(ClangASTContext::CopyType(context.GetASTContext(),
- user_type.GetASTContext(),
- user_type.GetOpaqueQualType()),
+ TypeFromParser parser_type(GuardedCopyType(context.GetASTContext(),
+ user_type.GetASTContext(),
+ user_type.GetOpaqueQualType()),
context.GetASTContext());
NamedDecl *var_decl = context.AddVarDecl(parser_type.GetOpaqueQualType());
@@ -1386,7 +1379,7 @@ ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context,
TypeList *type_list = fun_type->GetTypeList();
fun_ast_context = type_list->GetClangASTContext().getASTContext();
- void *copied_type = ClangASTContext::CopyType(context.GetASTContext(), fun_ast_context, fun_opaque_type);
+ void *copied_type = GuardedCopyType(context.GetASTContext(), fun_ast_context, fun_opaque_type);
fun_decl = context.AddFunDecl(copied_type);
}
@@ -1436,7 +1429,7 @@ ClangExpressionDeclMap::AddOneType(NameSearchContext &context,
clang::ASTContext *parser_ast_context = context.GetASTContext();
clang::ASTContext *user_ast_context = ut.GetASTContext();
- void *copied_type = ClangASTContext::CopyType(parser_ast_context, user_ast_context, ut.GetOpaqueQualType());
+ void *copied_type = GuardedCopyType(parser_ast_context, user_ast_context, ut.GetOpaqueQualType());
TypeFromParser parser_type(copied_type, parser_ast_context);
@@ -1471,3 +1464,19 @@ ClangExpressionDeclMap::AddOneType(NameSearchContext &context,
context.AddTypeDecl(copied_type);
}
+
+void *
+ClangExpressionDeclMap::GuardedCopyType (ASTContext *dest_context,
+ ASTContext *source_context,
+ void *clang_type)
+{
+ m_ignore_lookups = true;
+
+ void *ret = ClangASTContext::CopyType (dest_context,
+ source_context,
+ clang_type);
+
+ m_ignore_lookups = false;
+
+ return ret;
+}
OpenPOWER on IntegriCloud