[Lldb-commits] [lldb] 6e1fe49 - [lldb][NFC] Remove implementation of GetOriginalDecl and just call GetDeclOrigin instead

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Tue Dec 17 01:46:11 PST 2019


Author: Raphael Isemann
Date: 2019-12-17T10:42:09+01:00
New Revision: 6e1fe4966c402d17a253b38192cfd5e8b919ab8e

URL: https://github.com/llvm/llvm-project/commit/6e1fe4966c402d17a253b38192cfd5e8b919ab8e
DIFF: https://github.com/llvm/llvm-project/commit/6e1fe4966c402d17a253b38192cfd5e8b919ab8e.diff

LOG: [lldb][NFC] Remove implementation of GetOriginalDecl and just call GetDeclOrigin instead

Those functions have the same semantics beside some small optimization of not creating
a new empty ASTContextMetadataSP value in the metadata map. We never actually hit this
optimization according to test coverage so let's just call GetDeclOrigin instead.

Added: 
    

Modified: 
    lldb/source/Symbol/ClangASTImporter.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Symbol/ClangASTImporter.cpp b/lldb/source/Symbol/ClangASTImporter.cpp
index 1cfec2531d8b..3c11c3250af9 100644
--- a/lldb/source/Symbol/ClangASTImporter.cpp
+++ b/lldb/source/Symbol/ClangASTImporter.cpp
@@ -1139,16 +1139,5 @@ void ClangASTImporter::ASTImporterDelegate::Imported(clang::Decl *from,
 
 clang::Decl *
 ClangASTImporter::ASTImporterDelegate::GetOriginalDecl(clang::Decl *To) {
-  ASTContextMetadataSP to_context_md =
-      m_master.GetContextMetadata(&To->getASTContext());
-
-  if (!to_context_md)
-    return nullptr;
-
-  OriginMap::iterator iter = to_context_md->m_origins.find(To);
-
-  if (iter == to_context_md->m_origins.end())
-    return nullptr;
-
-  return const_cast<clang::Decl *>(iter->second.decl);
+  return m_master.GetDeclOrigin(To).decl;
 }


        


More information about the lldb-commits mailing list