[Lldb-commits] [lldb] r214583 - Fixed a problem in the Clang AST importer where

Sean Callanan scallanan at apple.com
Fri Aug 1 15:42:38 PDT 2014


Author: spyffe
Date: Fri Aug  1 17:42:38 2014
New Revision: 214583

URL: http://llvm.org/viewvc/llvm-project?rev=214583&view=rev
Log:
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.

<rdar://problem/16065049>

Modified:
    lldb/trunk/source/Symbol/ClangASTImporter.cpp

Modified: lldb/trunk/source/Symbol/ClangASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTImporter.cpp?rev=214583&r1=214582&r2=214583&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTImporter.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTImporter.cpp Fri Aug  1 17:42:38 2014
@@ -573,13 +573,13 @@ ClangASTImporter::Minion::Imported (clan
 
     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<clang::NamedDecl>(from))
         {
             std::string name_string;
@@ -611,8 +611,12 @@ ClangASTImporter::Minion::Imported (clan
 
         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 (clan
                     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",





More information about the lldb-commits mailing list