[lldb][NFC] Remove implementation of GetOriginalDecl and just call GetDeclOrigin...
authorRaphael Isemann <teemperor@gmail.com>
Tue, 17 Dec 2019 08:55:51 +0000 (09:55 +0100)
committerRaphael Isemann <teemperor@gmail.com>
Tue, 17 Dec 2019 09:42:09 +0000 (10:42 +0100)
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.

lldb/source/Symbol/ClangASTImporter.cpp

index 1cfec25..3c11c32 100644 (file)
@@ -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;
 }