[MLIR][NVVM] Add Op for TMA Store with reduction (#118853)
[llvm-project.git] / lldb / source / API / SBFormat.cpp
blob080e219d64a3626b3aad26ded535c45fb65a5d05
1 //===-- SBFormat.cpp ------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "lldb/API/SBFormat.h"
10 #include "Utils.h"
11 #include "lldb/Core/FormatEntity.h"
12 #include "lldb/lldb-types.h"
13 #include <lldb/API/SBError.h>
14 #include <lldb/Utility/Status.h>
16 using namespace lldb;
17 using namespace lldb_private;
19 SBFormat::SBFormat() : m_opaque_sp() {}
21 SBFormat::SBFormat(const SBFormat &rhs) {
22 m_opaque_sp = clone(rhs.m_opaque_sp);
25 SBFormat::~SBFormat() = default;
27 SBFormat &SBFormat::operator=(const SBFormat &rhs) {
28 if (this != &rhs)
29 m_opaque_sp = clone(rhs.m_opaque_sp);
30 return *this;
33 SBFormat::operator bool() const { return (bool)m_opaque_sp; }
35 SBFormat::SBFormat(const char *format, lldb::SBError &error) {
36 FormatEntrySP format_entry_sp = std::make_shared<FormatEntity::Entry>();
37 Status status = FormatEntity::Parse(format, *format_entry_sp);
39 error.SetError(std::move(status));
40 if (error.Success())
41 m_opaque_sp = format_entry_sp;
44 lldb::FormatEntrySP SBFormat::GetFormatEntrySP() const { return m_opaque_sp; }