From 608fb390a82ed953cbd6a75be224fa1703f0412a Mon Sep 17 00:00:00 2001 From: Sean Callanan Date: Fri, 1 Aug 2014 22:42:38 +0000 Subject: [PATCH] Fixed a problem in the Clang AST importer where we overrode debug information as the authoritative source for type information, substituting types from the Objective-C runtime. The runtime should never be the primary source. llvm-svn: 214583 --- lldb/source/Symbol/ClangASTImporter.cpp | 26 ++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/lldb/source/Symbol/ClangASTImporter.cpp b/lldb/source/Symbol/ClangASTImporter.cpp index debd05324d85..6579afb2f748 100644 --- a/lldb/source/Symbol/ClangASTImporter.cpp +++ b/lldb/source/Symbol/ClangASTImporter.cpp @@ -573,13 +573,13 @@ ClangASTImporter::Minion::Imported (clang::Decl *from, clang::Decl *to) Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); + lldb::user_id_t user_id = LLDB_INVALID_UID; + ClangASTMetadata *metadata = m_master.GetDeclMetadata(from); + if (metadata) + user_id = metadata->GetUserID(); + if (log) { - lldb::user_id_t user_id; - ClangASTMetadata *metadata = m_master.GetDeclMetadata(from); - if (metadata) - user_id = metadata->GetUserID(); - if (NamedDecl *from_named_decl = dyn_cast(from)) { std::string name_string; @@ -611,8 +611,12 @@ ClangASTImporter::Minion::Imported (clang::Decl *from, clang::Decl *to) if (origin_iter != origins.end()) { - to_context_md->m_origins[to] = origin_iter->second; - + if (to_context_md->m_origins.find(to) == to_context_md->m_origins.end() || + user_id != LLDB_INVALID_UID) + { + to_context_md->m_origins[to] = origin_iter->second; + } + MinionSP direct_completer = m_master.GetMinion(&to->getASTContext(), origin_iter->second.ctx); if (direct_completer.get() != this) @@ -636,9 +640,13 @@ ClangASTImporter::Minion::Imported (clang::Decl *from, clang::Decl *to) if (!m_decls_already_deported->count(to_named_decl)) m_decls_to_deport->insert(to_named_decl); } - } - to_context_md->m_origins[to] = DeclOrigin(m_source_ctx, from); + + if (to_context_md->m_origins.find(to) == to_context_md->m_origins.end() || + user_id != LLDB_INVALID_UID) + { + to_context_md->m_origins[to] = DeclOrigin(m_source_ctx, from); + } if (log) log->Printf(" [ClangASTImporter] Decl has no origin information in (ASTContext*)%p",