Path: blob/main/contrib/llvm-project/lldb/source/API/SBSaveCoreOptions.cpp
39587 views
//===-- SBSaveCoreOptions.cpp -----------------------------------*- C++ -*-===//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/SBSaveCoreOptions.h"9#include "lldb/API/SBError.h"10#include "lldb/API/SBFileSpec.h"11#include "lldb/Host/FileSystem.h"12#include "lldb/Symbol/SaveCoreOptions.h"13#include "lldb/Utility/Instrumentation.h"1415#include "Utils.h"1617using namespace lldb;1819SBSaveCoreOptions::SBSaveCoreOptions() {20LLDB_INSTRUMENT_VA(this)2122m_opaque_up = std::make_unique<lldb_private::SaveCoreOptions>();23}2425SBSaveCoreOptions::SBSaveCoreOptions(const SBSaveCoreOptions &rhs) {26LLDB_INSTRUMENT_VA(this, rhs);2728m_opaque_up = clone(rhs.m_opaque_up);29}3031SBSaveCoreOptions::~SBSaveCoreOptions() = default;3233const SBSaveCoreOptions &34SBSaveCoreOptions::operator=(const SBSaveCoreOptions &rhs) {35LLDB_INSTRUMENT_VA(this, rhs);3637if (this != &rhs)38m_opaque_up = clone(rhs.m_opaque_up);39return *this;40}4142SBError SBSaveCoreOptions::SetPluginName(const char *name) {43LLDB_INSTRUMENT_VA(this, name);44lldb_private::Status error = m_opaque_up->SetPluginName(name);45return SBError(error);46}4748void SBSaveCoreOptions::SetStyle(lldb::SaveCoreStyle style) {49LLDB_INSTRUMENT_VA(this, style);50m_opaque_up->SetStyle(style);51}5253void SBSaveCoreOptions::SetOutputFile(lldb::SBFileSpec file_spec) {54LLDB_INSTRUMENT_VA(this, file_spec);55m_opaque_up->SetOutputFile(file_spec.ref());56}5758const char *SBSaveCoreOptions::GetPluginName() const {59LLDB_INSTRUMENT_VA(this);60const auto name = m_opaque_up->GetPluginName();61if (!name)62return nullptr;63return lldb_private::ConstString(name.value()).GetCString();64}6566SBFileSpec SBSaveCoreOptions::GetOutputFile() const {67LLDB_INSTRUMENT_VA(this);68const auto file_spec = m_opaque_up->GetOutputFile();69if (file_spec)70return SBFileSpec(file_spec.value());71return SBFileSpec();72}7374lldb::SaveCoreStyle SBSaveCoreOptions::GetStyle() const {75LLDB_INSTRUMENT_VA(this);76return m_opaque_up->GetStyle();77}7879void SBSaveCoreOptions::Clear() {80LLDB_INSTRUMENT_VA(this);81m_opaque_up->Clear();82}8384lldb_private::SaveCoreOptions &SBSaveCoreOptions::ref() const {85return *m_opaque_up.get();86}878889