aboutsummaryrefslogtreecommitdiff
path: root/source/Plugins/Language/ObjC
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
commit3470cf4c94b4f5de021c51964556e05e2c77fa1e (patch)
treed34e73b1149ba724996bde04d2fdb33dff25e6b1 /source/Plugins/Language/ObjC
parentc2911d2b24f1d6b09fc0b0dda77ad2c25f4745b4 (diff)
downloadlldb-3470cf4c94b4f5de021c51964556e05e2c77fa1e.tar.gz
[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 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@367360 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'source/Plugins/Language/ObjC')
-rw-r--r--source/Plugins/Language/ObjC/CoreMedia.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/source/Plugins/Language/ObjC/CoreMedia.cpp b/source/Plugins/Language/ObjC/CoreMedia.cpp
index d19290ec5..247429da1 100644
--- a/source/Plugins/Language/ObjC/CoreMedia.cpp
+++ b/source/Plugins/Language/ObjC/CoreMedia.cpp
@@ -10,6 +10,7 @@
#include "CoreMedia.h"
#include "lldb/Utility/Flags.h"
+#include "lldb/Utility/Log.h"
#include "lldb/Symbol/TypeSystem.h"
#include "lldb/Target/Target.h"
@@ -25,18 +26,21 @@ bool lldb_private::formatters::CMTimeSummaryProvider(
if (!type.IsValid())
return false;
- TypeSystem *type_system =
+ auto type_system_or_err =
valobj.GetExecutionContextRef()
.GetTargetSP()
- ->GetScratchTypeSystemForLanguage(nullptr, lldb::eLanguageTypeC);
- if (!type_system)
+ ->GetScratchTypeSystemForLanguage(lldb::eLanguageTypeC);
+ if (auto err = type_system_or_err.takeError()) {
+ LLDB_LOG_ERROR(
+ lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS),
+ std::move(err), "Failed to get scratch type system");
return false;
-
+ }
// fetch children by offset to compensate for potential lack of debug info
- auto int64_ty =
- type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingSint, 64);
- auto int32_ty =
- type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingSint, 32);
+ auto int64_ty = type_system_or_err->GetBuiltinTypeForEncodingAndBitSize(
+ eEncodingSint, 64);
+ auto int32_ty = type_system_or_err->GetBuiltinTypeForEncodingAndBitSize(
+ eEncodingSint, 32);
auto value_sp(valobj.GetSyntheticChildAtOffset(0, int64_ty, true));
auto timescale_sp(valobj.GetSyntheticChildAtOffset(8, int32_ty, true));