[Lldb-commits] [PATCH] D92757: [lldb] Remove assumption from Clang-based data formatters that their types are in the scratch AST
Raphael Isemann via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Dec 10 08:35:29 PST 2020
This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rG839e84527789: [lldb] Remove assumption from Clang-based data formatters that their types areā¦ (authored by teemperor).
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92757/new/
https://reviews.llvm.org/D92757
Files:
lldb/source/DataFormatters/VectorType.cpp
lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
lldb/source/Plugins/Language/ObjC/CoreMedia.cpp
Index: lldb/source/Plugins/Language/ObjC/CoreMedia.cpp
===================================================================
--- lldb/source/Plugins/Language/ObjC/CoreMedia.cpp
+++ lldb/source/Plugins/Language/ObjC/CoreMedia.cpp
@@ -25,21 +25,12 @@
if (!type.IsValid())
return false;
- auto type_system_or_err =
- valobj.GetExecutionContextRef()
- .GetTargetSP()
- ->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;
- }
+ TypeSystem *type_system = type.GetTypeSystem();
// fetch children by offset to compensate for potential lack of debug info
- auto int64_ty = type_system_or_err->GetBuiltinTypeForEncodingAndBitSize(
- eEncodingSint, 64);
- auto int32_ty = type_system_or_err->GetBuiltinTypeForEncodingAndBitSize(
- eEncodingSint, 32);
+ auto int64_ty =
+ type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingSint, 64);
+ auto int32_ty =
+ type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingSint, 32);
auto value_sp(valobj.GetSyntheticChildAtOffset(0, int64_ty, true));
auto timescale_sp(valobj.GetSyntheticChildAtOffset(8, int32_ty, true));
Index: lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
===================================================================
--- lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
+++ lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
@@ -50,11 +50,7 @@
}
TypeSystemClang *clang_ast_context =
- llvm::dyn_cast<TypeSystemClang>(&type_system_or_err.get());
-
- if (!clang_ast_context) {
- return;
- }
+ llvm::cast<TypeSystemClang>(block_pointer_type.GetTypeSystem());
std::shared_ptr<ClangASTImporter> clang_ast_importer;
auto *state = target_sp->GetPersistentExpressionStateForLanguage(
Index: lldb/source/DataFormatters/VectorType.cpp
===================================================================
--- lldb/source/DataFormatters/VectorType.cpp
+++ lldb/source/DataFormatters/VectorType.cpp
@@ -220,20 +220,8 @@
CompilerType parent_type(m_backend.GetCompilerType());
CompilerType element_type;
parent_type.IsVectorType(&element_type, nullptr);
- TypeSystem *type_system = nullptr;
- if (auto target_sp = m_backend.GetTargetSP()) {
- auto type_system_or_err =
- target_sp->GetScratchTypeSystemForLanguage(lldb::eLanguageTypeC);
- if (auto err = type_system_or_err.takeError()) {
- LLDB_LOG_ERROR(
- lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS),
- std::move(err), "Unable to update from scratch TypeSystem");
- } else {
- type_system = &type_system_or_err.get();
- }
- }
- m_child_type =
- ::GetCompilerTypeForFormat(m_parent_format, element_type, type_system);
+ m_child_type = ::GetCompilerTypeForFormat(m_parent_format, element_type,
+ parent_type.GetTypeSystem());
m_num_children = ::CalculateNumChildren(parent_type, m_child_type);
m_item_format = GetItemFormatForFormat(m_parent_format, m_child_type);
return false;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92757.310914.patch
Type: text/x-patch
Size: 3337 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20201210/24ace98c/attachment.bin>
More information about the lldb-commits
mailing list