[Lldb-commits] [lldb] r176233 - Fixed some problems with type deportation:
Sean Callanan
scallanan at apple.com
Wed Feb 27 19:12:59 PST 2013
Author: spyffe
Date: Wed Feb 27 21:12:58 2013
New Revision: 176233
URL: http://llvm.org/viewvc/llvm-project?rev=176233&view=rev
Log:
Fixed some problems with type deportation:
- made sure we tell Clang not to try to
complete the type since it can't be
completed from its origin any more; and
- fixed a silly bug where we tried to
forget about the original decl's origins
rather than the deported decl's origin.
These produced some crashes in ptr_refs,
especially under libgmalloc.
<rdar://problem/13256150>
Modified:
lldb/trunk/source/Expression/ClangASTSource.cpp
lldb/trunk/source/Symbol/ClangASTImporter.cpp
Modified: lldb/trunk/source/Expression/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=176233&r1=176232&r2=176233&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Expression/ClangASTSource.cpp Wed Feb 27 21:12:58 2013
@@ -410,7 +410,7 @@ ClangASTSource::FindExternalLexicalDecls
if (log)
{
- log->Printf(" FELD[%u] Original decl (Decl*)%p:", current_id, original_decl);
+ log->Printf(" FELD[%u] Original decl (ASTContext*)%p (Decl*)%p:", current_id, original_ctx, original_decl);
ASTDumper(original_decl).ToLog(log, " ");
}
@@ -1442,9 +1442,10 @@ ClangASTSource::layoutRecordType(const R
if (log)
{
- log->Printf("LayoutRecordType[%u] on (RecordDecl*)%p [name = '%s']",
+ log->Printf("LayoutRecordType[%u] on (ASTContext*)%p for (RecordDecl*)%p [name = '%s']",
current_id,
m_ast_context,
+ record,
record->getNameAsString().c_str());
}
Modified: lldb/trunk/source/Symbol/ClangASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTImporter.cpp?rev=176233&r1=176232&r2=176233&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTImporter.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTImporter.cpp Wed Feb 27 21:12:58 2013
@@ -126,11 +126,20 @@ ClangASTImporter::DeportDecl (clang::AST
clang::ASTContext *src_ctx,
clang::Decl *decl)
{
+ lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+
+ if (log)
+ log->Printf(" [ClangASTImporter] DeportDecl called on (%sDecl*)%p from (ASTContext*)%p to (ASTContex*)%p",
+ decl->getDeclKindName(),
+ decl,
+ src_ctx,
+ dst_ctx);
+
clang::Decl *result = CopyDecl(dst_ctx, src_ctx, decl);
if (!result)
return NULL;
-
+
ClangASTContext::GetCompleteDecl (src_ctx, decl);
MinionSP minion_sp (GetMinion (dst_ctx, src_ctx));
@@ -140,12 +149,25 @@ ClangASTImporter::DeportDecl (clang::AST
ASTContextMetadataSP to_context_md = GetContextMetadata(dst_ctx);
- OriginMap::iterator oi = to_context_md->m_origins.find(decl);
+ OriginMap::iterator oi = to_context_md->m_origins.find(result);
if (oi != to_context_md->m_origins.end() &&
oi->second.ctx == src_ctx)
to_context_md->m_origins.erase(oi);
+ if (TagDecl *result_tag_decl = dyn_cast<TagDecl>(result))
+ {
+ result_tag_decl->setHasExternalLexicalStorage(false);
+ result_tag_decl->setHasExternalVisibleStorage(false);
+ }
+
+ if (log)
+ log->Printf(" [ClangASTImporter] DeportDecl deported (%sDecl*)%p to (%sDecl*)%p",
+ decl->getDeclKindName(),
+ decl,
+ result->getDeclKindName(),
+ result);
+
return result;
}
More information about the lldb-commits
mailing list