[Lldb-commits] [lldb] r192327 - Implemented the reverse-lookup API in the AST

Sean Callanan scallanan at apple.com
Wed Oct 9 15:33:34 PDT 2013


Author: spyffe
Date: Wed Oct  9 17:33:34 2013
New Revision: 192327

URL: http://llvm.org/viewvc/llvm-project?rev=192327&view=rev
Log:
Implemented the reverse-lookup API in the AST
importer to avoid duplicate imports of anonymous
structs.

<rdar://problem/14421722>

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

Modified: lldb/trunk/include/lldb/Symbol/ClangASTImporter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTImporter.h?rev=192327&r1=192326&r2=192327&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTImporter.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTImporter.h Wed Oct  9 17:33:34 2013
@@ -278,6 +278,8 @@ private:
         
         clang::Decl *Imported (clang::Decl *from, clang::Decl *to);
         
+        clang::Decl *GetOriginalDecl (clang::Decl *To);
+        
         std::set<clang::NamedDecl *>   *m_decls_to_deport;
         std::set<clang::NamedDecl *>   *m_decls_already_deported;
         ClangASTImporter               &m_master;

Modified: lldb/trunk/source/Symbol/ClangASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTImporter.cpp?rev=192327&r1=192326&r2=192327&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTImporter.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTImporter.cpp Wed Oct  9 17:33:34 2013
@@ -716,3 +716,18 @@ ClangASTImporter::Minion::Imported (clan
     
     return clang::ASTImporter::Imported(from, to);
 }
+
+clang::Decl *ClangASTImporter::Minion::GetOriginalDecl (clang::Decl *To)
+{
+    ASTContextMetadataSP to_context_md = m_master.GetContextMetadata(&To->getASTContext());
+    
+    if (!to_context_md)
+        return NULL;
+    
+    OriginMap::iterator iter = to_context_md->m_origins.find(To);
+    
+    if (iter == to_context_md->m_origins.end())
+        return NULL;
+    
+    return const_cast<clang::Decl*>(iter->second.decl);
+}





More information about the lldb-commits mailing list