diff options
Diffstat (limited to 'lldb/source/Plugins')
| -rw-r--r-- | lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp | 20 | ||||
| -rw-r--r-- | lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp | 10 |
2 files changed, 26 insertions, 4 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; diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp index 5212712b104..83cbe517643 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp @@ -272,9 +272,15 @@ static clang::QualType ExportAllDeclaredTypes( merger.AddSources(importer_source); clang::ASTImporter &exporter = merger.ImporterForOrigin(source); CompleteAllDeclContexts(exporter, file, root); - clang::QualType ret = exporter.Import(root); + llvm::Expected<clang::QualType> ret_or_error = exporter.Import(root); merger.RemoveSources(importer_source); - return ret; + if (ret_or_error) { + return *ret_or_error; + } else { + Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + LLDB_LOG_ERROR(log, ret_or_error.takeError(), "Couldn't import type: {0}"); + return clang::QualType(); + } } TypeFromUser ClangExpressionDeclMap::DeportType(ClangASTContext &target, |

