diff options
Diffstat (limited to 'lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp')
-rw-r--r-- | lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp index e67477440f3..92191793d19 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp @@ -1968,7 +1968,14 @@ clang::QualType ClangASTSource::CopyTypeWithMerger( return QualType(); } - return merger.ImporterForOrigin(from_context).Import(type); + if (llvm::Expected<QualType> type_or_error = + merger.ImporterForOrigin(from_context).Import(type)) { + return *type_or_error; + } else { + Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + LLDB_LOG_ERROR(log, type_or_error.takeError(), "Couldn't import type: {0}"); + return QualType(); + } } clang::Decl *ClangASTSource::CopyDecl(Decl *src_decl) { @@ -1981,7 +1988,16 @@ clang::Decl *ClangASTSource::CopyDecl(Decl *src_decl) { return nullptr; } - return m_merger_up->ImporterForOrigin(from_context).Import(src_decl); + if (llvm::Expected<Decl *> decl_or_error = + m_merger_up->ImporterForOrigin(from_context).Import(src_decl)) { + return *decl_or_error; + } else { + Log *log = + lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + LLDB_LOG_ERROR(log, decl_or_error.takeError(), + "Couldn't import decl: {0}"); + return nullptr; + } } else { lldbassert(0 && "No mechanism for copying a decl!"); return nullptr; |