summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
diff options
context:
space:
mode:
authorGabor Marton <martongabesz@gmail.com>2019-05-15 10:29:48 +0000
committerGabor Marton <martongabesz@gmail.com>2019-05-15 10:29:48 +0000
commit5ac6d49065df82b7015fabb533e7a130b8e7f86f (patch)
tree796c2bbbb010d9f1168829a7d2c16a717b4ce25d /lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
parentda08fae397092d9f117378f07061c326de05251c (diff)
downloadbcm5719-llvm-5ac6d49065df82b7015fabb533e7a130b8e7f86f.tar.gz
bcm5719-llvm-5ac6d49065df82b7015fabb533e7a130b8e7f86f.zip
[ASTImporter] Use llvm::Expected and Error in the importer API
Summary: This is the final phase of the refactoring towards using llvm::Expected and llvm::Error in the ASTImporter API. This involves the following: - remove old Import functions which returned with a pointer, - use the Import_New functions (which return with Err or Expected) everywhere and handle their return value - rename Import_New functions to Import This affects both Clang and LLDB. Reviewers: shafik, teemperor, aprantl, a_sidorin, balazske, a.sidorin Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits, lldb-commits Tags: #clang, #lldb Differential Revision: https://reviews.llvm.org/D61438 llvm-svn: 360760
Diffstat (limited to 'lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp')
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp20
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;
OpenPOWER on IntegriCloud