diff options
Diffstat (limited to 'source/Symbol/CxxModuleHandler.cpp')
-rw-r--r-- | source/Symbol/CxxModuleHandler.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/source/Symbol/CxxModuleHandler.cpp b/source/Symbol/CxxModuleHandler.cpp index 68a2aab80bd6..19e80e5036bc 100644 --- a/source/Symbol/CxxModuleHandler.cpp +++ b/source/Symbol/CxxModuleHandler.cpp @@ -175,6 +175,8 @@ T *createDecl(ASTImporter &importer, Decl *from_d, Args &&... args) { } llvm::Optional<Decl *> CxxModuleHandler::tryInstantiateStdTemplate(Decl *d) { + Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + // If we don't have a template to instiantiate, then there is nothing to do. auto td = dyn_cast<ClassTemplateSpecializationDecl>(d); if (!td) @@ -196,9 +198,15 @@ llvm::Optional<Decl *> CxxModuleHandler::tryInstantiateStdTemplate(Decl *d) { // Find the local DeclContext that corresponds to the DeclContext of our // decl we want to import. - auto to_context = getEqualLocalDeclContext(*m_sema, td->getDeclContext()); - if (!to_context) + llvm::Expected<DeclContext *> to_context = + getEqualLocalDeclContext(*m_sema, td->getDeclContext()); + if (!to_context) { + LLDB_LOG_ERROR(log, to_context.takeError(), + "Got error while searching equal local DeclContext for decl " + "'{1}':\n{0}", + td->getName()); return {}; + } // Look up the template in our local context. std::unique_ptr<LookupResult> lookup = @@ -215,8 +223,6 @@ llvm::Optional<Decl *> CxxModuleHandler::tryInstantiateStdTemplate(Decl *d) { // Import the foreign template arguments. llvm::SmallVector<TemplateArgument, 4> imported_args; - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); - // If this logic is changed, also update templateArgsAreSupported. for (const TemplateArgument &arg : foreign_args.asArray()) { switch (arg.getKind()) { |