diff options
| author | Alex Langford <apl@fb.com> | 2019-07-30 22:12:34 +0000 |
|---|---|---|
| committer | Alex Langford <apl@fb.com> | 2019-07-30 22:12:34 +0000 |
| commit | 0e252e38ef84e42cc0b6d0e6b0f0894f6867e5a7 (patch) | |
| tree | e74b7e4f611ee1a334968d8cedd4c9f3cb921269 /lldb/source/Expression | |
| parent | d56dc1d926b9ee2317f3766d21700bdc77dd84f6 (diff) | |
| download | bcm5719-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/Expression')
| -rw-r--r-- | lldb/source/Expression/Materializer.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lldb/source/Expression/Materializer.cpp b/lldb/source/Expression/Materializer.cpp index e86afb6018a..291f81e5a6a 100644 --- a/lldb/source/Expression/Materializer.cpp +++ b/lldb/source/Expression/Materializer.cpp @@ -869,20 +869,18 @@ public: return; } - Status type_system_error; - TypeSystem *type_system = target_sp->GetScratchTypeSystemForLanguage( - &type_system_error, m_type.GetMinimumLanguage()); + auto type_system_or_err = + target_sp->GetScratchTypeSystemForLanguage(m_type.GetMinimumLanguage()); - if (!type_system) { + if (auto error = type_system_or_err.takeError()) { err.SetErrorStringWithFormat("Couldn't dematerialize a result variable: " "couldn't get the corresponding type " "system: %s", - type_system_error.AsCString()); + llvm::toString(std::move(error)).c_str()); return; } - PersistentExpressionState *persistent_state = - type_system->GetPersistentExpressionState(); + type_system_or_err->GetPersistentExpressionState(); if (!persistent_state) { err.SetErrorString("Couldn't dematerialize a result variable: " |

