Path: blob/main/contrib/llvm-project/lldb/source/API/SBFormat.cpp
39587 views
//===-- SBFormat.cpp ------------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "lldb/API/SBFormat.h"9#include "Utils.h"10#include "lldb/Core/FormatEntity.h"11#include "lldb/lldb-types.h"12#include <lldb/API/SBError.h>13#include <lldb/Utility/Status.h>1415using namespace lldb;16using namespace lldb_private;1718SBFormat::SBFormat() : m_opaque_sp() {}1920SBFormat::SBFormat(const SBFormat &rhs) {21m_opaque_sp = clone(rhs.m_opaque_sp);22}2324SBFormat::~SBFormat() = default;2526SBFormat &SBFormat::operator=(const SBFormat &rhs) {27if (this != &rhs)28m_opaque_sp = clone(rhs.m_opaque_sp);29return *this;30}3132SBFormat::operator bool() const { return (bool)m_opaque_sp; }3334SBFormat::SBFormat(const char *format, lldb::SBError &error) {35FormatEntrySP format_entry_sp = std::make_shared<FormatEntity::Entry>();36Status status = FormatEntity::Parse(format, *format_entry_sp);3738error.SetError(status);39if (error.Success())40m_opaque_sp = format_entry_sp;41}4243lldb::FormatEntrySP SBFormat::GetFormatEntrySP() const { return m_opaque_sp; }444546