diff options
Diffstat (limited to 'source/Interpreter/Property.cpp')
-rw-r--r-- | source/Interpreter/Property.cpp | 64 |
1 files changed, 35 insertions, 29 deletions
diff --git a/source/Interpreter/Property.cpp b/source/Interpreter/Property.cpp index 5f1022347cf4..78209311e2e5 100644 --- a/source/Interpreter/Property.cpp +++ b/source/Interpreter/Property.cpp @@ -1,9 +1,8 @@ //===-- Property.cpp --------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -16,6 +15,8 @@ #include "lldb/Interpreter/OptionValues.h" #include "lldb/Target/Language.h" +#include <memory> + using namespace lldb; using namespace lldb_private; @@ -30,18 +31,20 @@ Property::Property(const PropertyDefinition &definition) // "definition.default_uint_value" is not used // "definition.default_cstr_value" as a string value that represents the // default string value for the architecture/triple - m_value_sp.reset(new OptionValueArch(definition.default_cstr_value)); + m_value_sp = + std::make_shared<OptionValueArch>(definition.default_cstr_value); break; case OptionValue::eTypeArgs: // "definition.default_uint_value" is always a OptionValue::Type - m_value_sp.reset(new OptionValueArgs()); + m_value_sp = std::make_shared<OptionValueArgs>(); break; case OptionValue::eTypeArray: // "definition.default_uint_value" is always a OptionValue::Type - m_value_sp.reset(new OptionValueArray(OptionValue::ConvertTypeToMask( - (OptionValue::Type)definition.default_uint_value))); + m_value_sp = + std::make_shared<OptionValueArray>(OptionValue::ConvertTypeToMask( + (OptionValue::Type)definition.default_uint_value)); break; case OptionValue::eTypeBoolean: @@ -50,11 +53,12 @@ Property::Property(const PropertyDefinition &definition) // "definition.default_cstr_value" as a string value that represents the // default value. if (definition.default_cstr_value) - m_value_sp.reset(new OptionValueBoolean(OptionArgParser::ToBoolean( - llvm::StringRef(definition.default_cstr_value), false, nullptr))); + m_value_sp = + std::make_shared<OptionValueBoolean>(OptionArgParser::ToBoolean( + llvm::StringRef(definition.default_cstr_value), false, nullptr)); else - m_value_sp.reset( - new OptionValueBoolean(definition.default_uint_value != 0)); + m_value_sp = std::make_shared<OptionValueBoolean>( + definition.default_uint_value != 0); break; case OptionValue::eTypeChar: { @@ -65,8 +69,9 @@ Property::Property(const PropertyDefinition &definition) } case OptionValue::eTypeDictionary: // "definition.default_uint_value" is always a OptionValue::Type - m_value_sp.reset(new OptionValueDictionary(OptionValue::ConvertTypeToMask( - (OptionValue::Type)definition.default_uint_value))); + m_value_sp = + std::make_shared<OptionValueDictionary>(OptionValue::ConvertTypeToMask( + (OptionValue::Type)definition.default_uint_value)); break; case OptionValue::eTypeEnum: @@ -101,14 +106,14 @@ Property::Property(const PropertyDefinition &definition) FileSpec file_spec = FileSpec(definition.default_cstr_value); if (resolve) FileSystem::Instance().Resolve(file_spec); - m_value_sp.reset(new OptionValueFileSpec(file_spec, resolve)); + m_value_sp = std::make_shared<OptionValueFileSpec>(file_spec, resolve); break; } case OptionValue::eTypeFileSpecList: // "definition.default_uint_value" is not used for a // OptionValue::eTypeFileSpecList - m_value_sp.reset(new OptionValueFileSpecList()); + m_value_sp = std::make_shared<OptionValueFileSpecList>(); break; case OptionValue::eTypeFormat: @@ -123,7 +128,7 @@ Property::Property(const PropertyDefinition &definition) nullptr); else new_format = (Format)definition.default_uint_value; - m_value_sp.reset(new OptionValueFormat(new_format)); + m_value_sp = std::make_shared<OptionValueFormat>(new_format); } break; @@ -139,29 +144,30 @@ Property::Property(const PropertyDefinition &definition) llvm::StringRef(definition.default_cstr_value)); else new_lang = (LanguageType)definition.default_uint_value; - m_value_sp.reset(new OptionValueLanguage(new_lang)); + m_value_sp = std::make_shared<OptionValueLanguage>(new_lang); } break; case OptionValue::eTypeFormatEntity: // "definition.default_cstr_value" as a string value that represents the // default - m_value_sp.reset( - new OptionValueFormatEntity(definition.default_cstr_value)); + m_value_sp = std::make_shared<OptionValueFormatEntity>( + definition.default_cstr_value); break; case OptionValue::eTypePathMap: // "definition.default_uint_value" tells us if notifications should occur // for path mappings - m_value_sp.reset( - new OptionValuePathMappings(definition.default_uint_value != 0)); + m_value_sp = std::make_shared<OptionValuePathMappings>( + definition.default_uint_value != 0); break; case OptionValue::eTypeRegex: // "definition.default_uint_value" is used to the regular expression flags // "definition.default_cstr_value" the default regular expression value // value. - m_value_sp.reset(new OptionValueRegex(definition.default_cstr_value)); + m_value_sp = + std::make_shared<OptionValueRegex>(definition.default_cstr_value); break; case OptionValue::eTypeSInt64: @@ -169,10 +175,10 @@ Property::Property(const PropertyDefinition &definition) // "definition.default_cstr_value" is NULL, otherwise interpret // "definition.default_cstr_value" as a string value that represents the // default value. - m_value_sp.reset(new OptionValueSInt64( + m_value_sp = std::make_shared<OptionValueSInt64>( definition.default_cstr_value ? StringConvert::ToSInt64(definition.default_cstr_value) - : definition.default_uint_value)); + : definition.default_uint_value); break; case OptionValue::eTypeUInt64: @@ -180,10 +186,10 @@ Property::Property(const PropertyDefinition &definition) // "definition.default_cstr_value" is NULL, otherwise interpret // "definition.default_cstr_value" as a string value that represents the // default value. - m_value_sp.reset(new OptionValueUInt64( + m_value_sp = std::make_shared<OptionValueUInt64>( definition.default_cstr_value ? StringConvert::ToUInt64(definition.default_cstr_value) - : definition.default_uint_value)); + : definition.default_uint_value); break; case OptionValue::eTypeUUID: @@ -193,7 +199,7 @@ Property::Property(const PropertyDefinition &definition) UUID uuid; if (definition.default_cstr_value) uuid.SetFromStringRef(definition.default_cstr_value); - m_value_sp.reset(new OptionValueUUID(uuid)); + m_value_sp = std::make_shared<OptionValueUUID>(uuid); } break; @@ -212,7 +218,7 @@ Property::Property(const PropertyDefinition &definition) } } -Property::Property(const ConstString &name, const ConstString &desc, +Property::Property(ConstString name, ConstString desc, bool is_global, const lldb::OptionValueSP &value_sp) : m_name(name), m_description(desc), m_value_sp(value_sp), m_is_global(is_global) {} |