summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
diff options
context:
space:
mode:
authorAlex Langford <apl@fb.com>2019-07-30 22:12:34 +0000
committerAlex Langford <apl@fb.com>2019-07-30 22:12:34 +0000
commit0e252e38ef84e42cc0b6d0e6b0f0894f6867e5a7 (patch)
treee74b7e4f611ee1a334968d8cedd4c9f3cb921269 /lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
parentd56dc1d926b9ee2317f3766d21700bdc77dd84f6 (diff)
downloadbcm5719-llvm-0e252e38ef84e42cc0b6d0e6b0f0894f6867e5a7.tar.gz
bcm5719-llvm-0e252e38ef84e42cc0b6d0e6b0f0894f6867e5a7.zip
[Symbol] Use llvm::Expected when getting TypeSystems
Summary: This commit achieves the following: - Functions used to return a `TypeSystem *` return an `llvm::Expected<TypeSystem *>` now. This means that the result of a call is always checked, forcing clients to move more carefully. - `TypeSystemMap::GetTypeSystemForLanguage` will either return an Error or a non-null pointer to a TypeSystem. Reviewers: JDevlieghere, davide, compnerd Subscribers: jdoerfert, lldb-commits Differential Revision: https://reviews.llvm.org/D65122 llvm-svn: 367360
Diffstat (limited to 'lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp')
-rw-r--r--lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp b/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
index 87b5b5947f3..5cfd978774f 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
@@ -17,6 +17,7 @@
#include "lldb/Target/Target.h"
#include "lldb/Utility/LLDBAssert.h"
+#include "lldb/Utility/Log.h"
using namespace lldb;
using namespace lldb_private;
@@ -39,16 +40,17 @@ public:
return;
}
- Status err;
- TypeSystem *type_system = target_sp->GetScratchTypeSystemForLanguage(
- &err, lldb::eLanguageTypeC_plus_plus);
-
- if (!err.Success() || !type_system) {
+ auto type_system_or_err = target_sp->GetScratchTypeSystemForLanguage(
+ lldb::eLanguageTypeC_plus_plus);
+ if (auto err = type_system_or_err.takeError()) {
+ LLDB_LOG_ERROR(
+ lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS),
+ std::move(err), "Failed to get scratch ClangASTContext");
return;
}
ClangASTContext *clang_ast_context =
- llvm::dyn_cast<ClangASTContext>(type_system);
+ llvm::dyn_cast<ClangASTContext>(&type_system_or_err.get());
if (!clang_ast_context) {
return;
OpenPOWER on IntegriCloud