diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp index b4e81aa21c13..ad48d293ab8f 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp @@ -387,7 +387,7 @@ bool ClangExpressionSourceCode::GetText( *sc.comp_unit, modules_for_macros)) LLDB_LOG_ERROR( GetLog(LLDBLog::Expressions), std::move(err), - "Error while loading hand-imported modules: {0}"); + "Error while loading hand-imported modules:\n{0}"); } } } diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp index 6c5243b853dd..7635e4905121 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp @@ -436,13 +436,13 @@ llvm::Error ClangModulesDeclVendorImpl::AddModulesForCompileUnit( if (!LanguageSupportsClangModules(cu.GetLanguage())) return llvm::Error::success(); - for (auto &imported_module : cu.GetImportedModules()) - // TODO: don't short-circuit. Continue loading modules even if one of them - // fails. Concatenate all the errors. - if (auto err = AddModule(imported_module, &exported_modules)) - return err; + llvm::Error errors = llvm::Error::success(); - return llvm::Error::success(); + for (auto &imported_module : cu.GetImportedModules()) + if (auto err = AddModule(imported_module, &exported_modules)) + errors = llvm::joinErrors(std::move(errors), std::move(err)); + + return errors; } // ClangImporter::lookupValue diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp index 13d32b3bbc4f..9a5d49a7ea36 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp @@ -381,8 +381,10 @@ static void SetupDeclVendor(ExecutionContext &exe_ctx, Target *target, // FIXME: should we be dumping these to the error log instead of as // diagnostics? They are non-fatal and are usually quite noisy. - diagnostic_manager.PutString(lldb::eSeverityInfo, - llvm::toString(std::move(err))); + llvm::handleAllErrors( + std::move(err), [&diagnostic_manager](const llvm::StringError &e) { + diagnostic_manager.PutString(lldb::eSeverityInfo, e.getMessage()); + }); } ClangExpressionSourceCode::WrapKind ClangUserExpression::GetWrapKind() const { diff --git a/lldb/test/Shell/Expr/TestClangModuleLoadError_InvalidSearchPath.test b/lldb/test/Shell/Expr/TestClangModuleLoadError_InvalidSearchPath.test index 0fda05283608..e5a6334d2ee2 100644 --- a/lldb/test/Shell/Expr/TestClangModuleLoadError_InvalidSearchPath.test +++ b/lldb/test/Shell/Expr/TestClangModuleLoadError_InvalidSearchPath.test @@ -43,5 +43,4 @@ run expr blah # CHECK: note: couldn't find module search path directory {{.*}}sources -## FIXME: We never attempted to load bar. -# CHECK-NOT: couldn't find module search path +# CHECK: note: couldn't find module search path directory {{.*}}sources diff --git a/lldb/test/Shell/Expr/TestClangModuleLoadError_InvalidTopLevelModule.test b/lldb/test/Shell/Expr/TestClangModuleLoadError_InvalidTopLevelModule.test index a50f784dd1dc..189a3c0fcdf2 100644 --- a/lldb/test/Shell/Expr/TestClangModuleLoadError_InvalidTopLevelModule.test +++ b/lldb/test/Shell/Expr/TestClangModuleLoadError_InvalidTopLevelModule.test @@ -44,5 +44,6 @@ expr blah # CHECK: note: couldn't load top-level module foo ## FIXME: clang error diagnostic shouldn't be dumped to the console. # CHECK: error: -## FIXME: We never attempted to load bar. -# CHECK-NOT: bar +# CHECK: note: couldn't load top-level module bar +## FIXME: clang error diagnostic shouldn't be dumped to the console. +# CHECK: error: diff --git a/lldb/test/Shell/Expr/TestClangModuleLoadError_ModulemapParsing.test b/lldb/test/Shell/Expr/TestClangModuleLoadError_ModulemapParsing.test index cadeb2de02c8..53efffffe435 100644 --- a/lldb/test/Shell/Expr/TestClangModuleLoadError_ModulemapParsing.test +++ b/lldb/test/Shell/Expr/TestClangModuleLoadError_ModulemapParsing.test @@ -42,5 +42,4 @@ run expr blah # CHECK: note: failed to parse and load modulemap file in {{.*}}sources -## FIXME: We never attempted to load bar. -# CHECK-NOT: failed to parse and load modulemap +# CHECK: note: failed to parse and load modulemap file in {{.*}}sources diff --git a/lldb/test/Shell/Expr/TestClangModuleLoadError_NoModule.test b/lldb/test/Shell/Expr/TestClangModuleLoadError_NoModule.test index a14f51eeba07..296261408693 100644 --- a/lldb/test/Shell/Expr/TestClangModuleLoadError_NoModule.test +++ b/lldb/test/Shell/Expr/TestClangModuleLoadError_NoModule.test @@ -43,5 +43,4 @@ run expr blah # CHECK: note: header search couldn't locate module 'foo' -## FIXME: We never attempted to load bar. -# CHECK-NOT: bar +# CHECK: note: header search couldn't locate module 'bar' diff --git a/lldb/test/Shell/Expr/TestClangModuleLoadError_NoModuleMap.test b/lldb/test/Shell/Expr/TestClangModuleLoadError_NoModuleMap.test index a4fcace4f5b5..917facb05fd4 100644 --- a/lldb/test/Shell/Expr/TestClangModuleLoadError_NoModuleMap.test +++ b/lldb/test/Shell/Expr/TestClangModuleLoadError_NoModuleMap.test @@ -38,5 +38,4 @@ run expr blah # CHECK: note: couldn't find modulemap file in {{.*}}sources -## FIXME: We never attempted to load bar. -# CHECK-NOT: couldn't find modulemap +# CHECK: note: couldn't find modulemap file in {{.*}}sources