Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
source/Plugins/Language/ObjC/CoreMedia.cpp
//===-- CoreMedia.cpp --------------------------------------------*- C++ | //===-- CoreMedia.cpp --------------------------------------------*- C++ | ||||
//-*-===// | //-*-===// | ||||
// | // | ||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||||
// See https://llvm.org/LICENSE.txt for license information. | // See https://llvm.org/LICENSE.txt for license information. | ||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||||
// | // | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
#include "CoreMedia.h" | #include "CoreMedia.h" | ||||
#include "lldb/Utility/Flags.h" | #include "lldb/Utility/Flags.h" | ||||
#include "lldb/Utility/Log.h" | |||||
#include "lldb/Symbol/TypeSystem.h" | #include "lldb/Symbol/TypeSystem.h" | ||||
#include "lldb/Target/Target.h" | #include "lldb/Target/Target.h" | ||||
#include <inttypes.h> | #include <inttypes.h> | ||||
using namespace lldb; | using namespace lldb; | ||||
using namespace lldb_private; | using namespace lldb_private; | ||||
using namespace lldb_private::formatters; | using namespace lldb_private::formatters; | ||||
bool lldb_private::formatters::CMTimeSummaryProvider( | bool lldb_private::formatters::CMTimeSummaryProvider( | ||||
ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) { | ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) { | ||||
CompilerType type = valobj.GetCompilerType(); | CompilerType type = valobj.GetCompilerType(); | ||||
if (!type.IsValid()) | if (!type.IsValid()) | ||||
return false; | return false; | ||||
TypeSystem *type_system = | auto type_system_or_err = | ||||
valobj.GetExecutionContextRef() | valobj.GetExecutionContextRef() | ||||
.GetTargetSP() | .GetTargetSP() | ||||
->GetScratchTypeSystemForLanguage(nullptr, lldb::eLanguageTypeC); | ->GetScratchTypeSystemForLanguage(lldb::eLanguageTypeC); | ||||
if (!type_system) | 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; | return false; | ||||
} | |||||
// fetch children by offset to compensate for potential lack of debug info | // fetch children by offset to compensate for potential lack of debug info | ||||
auto int64_ty = | auto int64_ty = type_system_or_err->GetBuiltinTypeForEncodingAndBitSize( | ||||
type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingSint, 64); | eEncodingSint, 64); | ||||
auto int32_ty = | auto int32_ty = type_system_or_err->GetBuiltinTypeForEncodingAndBitSize( | ||||
type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingSint, 32); | eEncodingSint, 32); | ||||
auto value_sp(valobj.GetSyntheticChildAtOffset(0, int64_ty, true)); | auto value_sp(valobj.GetSyntheticChildAtOffset(0, int64_ty, true)); | ||||
auto timescale_sp(valobj.GetSyntheticChildAtOffset(8, int32_ty, true)); | auto timescale_sp(valobj.GetSyntheticChildAtOffset(8, int32_ty, true)); | ||||
auto flags_sp(valobj.GetSyntheticChildAtOffset(12, int32_ty, true)); | auto flags_sp(valobj.GetSyntheticChildAtOffset(12, int32_ty, true)); | ||||
if (!value_sp || !timescale_sp || !flags_sp) | if (!value_sp || !timescale_sp || !flags_sp) | ||||
return false; | return false; | ||||
▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines |