[Lldb-commits] [lldb] 8cdcd41 - [lldb/Interpreter][NFC] Remove explicit default initialization of members and base classes

2021-02-28 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2021-02-28T19:23:18+03:00
New Revision: 8cdcd41e384b4901cd796f7be58c461647e54d18

URL: 
https://github.com/llvm/llvm-project/commit/8cdcd41e384b4901cd796f7be58c461647e54d18
DIFF: 
https://github.com/llvm/llvm-project/commit/8cdcd41e384b4901cd796f7be58c461647e54d18.diff

LOG: [lldb/Interpreter][NFC] Remove explicit default initialization of members 
and base classes

According to clang-tidy's readability-redundant-member-init.

Added: 


Modified: 
lldb/include/lldb/Interpreter/OptionGroupPlatform.h
lldb/include/lldb/Interpreter/OptionValueArch.h
lldb/include/lldb/Interpreter/OptionValueBoolean.h
lldb/include/lldb/Interpreter/OptionValueChar.h
lldb/include/lldb/Interpreter/OptionValueDictionary.h
lldb/include/lldb/Interpreter/OptionValueFileSpecList.h
lldb/include/lldb/Interpreter/OptionValueFormat.h
lldb/include/lldb/Interpreter/OptionValueLanguage.h
lldb/include/lldb/Interpreter/OptionValuePathMappings.h
lldb/include/lldb/Interpreter/OptionValueRegex.h
lldb/include/lldb/Interpreter/OptionValueSInt64.h
lldb/include/lldb/Interpreter/OptionValueString.h
lldb/include/lldb/Interpreter/OptionValueUInt64.h
lldb/include/lldb/Interpreter/OptionValueUUID.h
lldb/include/lldb/Interpreter/Options.h
lldb/source/Interpreter/CommandAlias.cpp
lldb/source/Interpreter/CommandInterpreter.cpp
lldb/source/Interpreter/CommandObject.cpp
lldb/source/Interpreter/OptionGroupFile.cpp
lldb/source/Interpreter/OptionGroupOutputFile.cpp
lldb/source/Interpreter/OptionGroupPythonClassWithDict.cpp
lldb/source/Interpreter/OptionGroupVariable.cpp
lldb/source/Interpreter/OptionValueEnumeration.cpp
lldb/source/Interpreter/OptionValueFileColonLine.cpp
lldb/source/Interpreter/OptionValueFileSpec.cpp
lldb/source/Interpreter/OptionValueFormatEntity.cpp
lldb/source/Interpreter/OptionValueProperties.cpp
lldb/source/Interpreter/Options.cpp
lldb/source/Interpreter/Property.cpp

Removed: 




diff  --git a/lldb/include/lldb/Interpreter/OptionGroupPlatform.h 
b/lldb/include/lldb/Interpreter/OptionGroupPlatform.h
index 99945e5246fd..fed2791a6130 100644
--- a/lldb/include/lldb/Interpreter/OptionGroupPlatform.h
+++ b/lldb/include/lldb/Interpreter/OptionGroupPlatform.h
@@ -21,8 +21,7 @@ namespace lldb_private {
 class OptionGroupPlatform : public OptionGroup {
 public:
   OptionGroupPlatform(bool include_platform_option)
-  : OptionGroup(), m_platform_name(), m_sdk_sysroot(),
-m_include_platform_option(include_platform_option) {}
+  : m_include_platform_option(include_platform_option) {}
 
   ~OptionGroupPlatform() override = default;
 

diff  --git a/lldb/include/lldb/Interpreter/OptionValueArch.h 
b/lldb/include/lldb/Interpreter/OptionValueArch.h
index d079b3896531..22f75a6259c5 100644
--- a/lldb/include/lldb/Interpreter/OptionValueArch.h
+++ b/lldb/include/lldb/Interpreter/OptionValueArch.h
@@ -19,17 +19,15 @@ class OptionValueArch : public OptionValue {
 public:
   OptionValueArch() = default;
 
-  OptionValueArch(const char *triple)
-  : OptionValue(), m_current_value(triple), m_default_value() {
+  OptionValueArch(const char *triple) : m_current_value(triple) {
 m_default_value = m_current_value;
   }
 
   OptionValueArch(const ArchSpec &value)
-  : OptionValue(), m_current_value(value), m_default_value(value) {}
+  : m_current_value(value), m_default_value(value) {}
 
   OptionValueArch(const ArchSpec ¤t_value, const ArchSpec &default_value)
-  : OptionValue(), m_current_value(current_value),
-m_default_value(default_value) {}
+  : m_current_value(current_value), m_default_value(default_value) {}
 
   ~OptionValueArch() override = default;
 

diff  --git a/lldb/include/lldb/Interpreter/OptionValueBoolean.h 
b/lldb/include/lldb/Interpreter/OptionValueBoolean.h
index d0eb4362d466..6ae464bd8fb2 100644
--- a/lldb/include/lldb/Interpreter/OptionValueBoolean.h
+++ b/lldb/include/lldb/Interpreter/OptionValueBoolean.h
@@ -16,10 +16,9 @@ namespace lldb_private {
 class OptionValueBoolean : public OptionValue {
 public:
   OptionValueBoolean(bool value)
-  : OptionValue(), m_current_value(value), m_default_value(value) {}
+  : m_current_value(value), m_default_value(value) {}
   OptionValueBoolean(bool current_value, bool default_value)
-  : OptionValue(), m_current_value(current_value),
-m_default_value(default_value) {}
+  : m_current_value(current_value), m_default_value(default_value) {}
 
   ~OptionValueBoolean() override = default;
 

diff  --git a/lldb/include/lldb/Interpreter/OptionValueChar.h 
b/lldb/include/lldb/Interpreter/OptionValueChar.h
index f3fd28104067..78f91df99842 100644
--- a/lldb/include/lldb/Interpreter/OptionValueChar.h
+++ b/lldb/include/lldb/Interpreter/OptionValueChar.h
@@ -16,11 +16,10 @@ namespace lldb_private {
 class OptionVal

[Lldb-commits] [lldb] 54d03a4 - [lldb/Interpreter][NFC] Replace default constructors/destructors bodies with "=default"

2021-02-28 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2021-02-28T19:23:16+03:00
New Revision: 54d03a4985bc9a0a84c4dff835ec6ed0f607582f

URL: 
https://github.com/llvm/llvm-project/commit/54d03a4985bc9a0a84c4dff835ec6ed0f607582f
DIFF: 
https://github.com/llvm/llvm-project/commit/54d03a4985bc9a0a84c4dff835ec6ed0f607582f.diff

LOG: [lldb/Interpreter][NFC] Replace default constructors/destructors bodies 
with "=default"

Added: 


Modified: 
lldb/include/lldb/Interpreter/CommandHistory.h
lldb/include/lldb/Interpreter/CommandObject.h
lldb/include/lldb/Interpreter/CommandReturnObject.h
lldb/include/lldb/Interpreter/OptionGroupArchitecture.h
lldb/include/lldb/Interpreter/OptionGroupBoolean.h
lldb/include/lldb/Interpreter/OptionGroupFile.h
lldb/include/lldb/Interpreter/OptionGroupFormat.h
lldb/include/lldb/Interpreter/OptionGroupOutputFile.h
lldb/include/lldb/Interpreter/OptionGroupPythonClassWithDict.h
lldb/include/lldb/Interpreter/OptionGroupString.h
lldb/include/lldb/Interpreter/OptionGroupUInt64.h
lldb/include/lldb/Interpreter/OptionGroupUUID.h
lldb/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h
lldb/include/lldb/Interpreter/OptionGroupVariable.h
lldb/include/lldb/Interpreter/OptionGroupWatchpoint.h
lldb/include/lldb/Interpreter/OptionValueArch.h
lldb/include/lldb/Interpreter/OptionValueArgs.h
lldb/include/lldb/Interpreter/OptionValueArray.h
lldb/include/lldb/Interpreter/OptionValueBoolean.h
lldb/include/lldb/Interpreter/OptionValueChar.h
lldb/include/lldb/Interpreter/OptionValueDictionary.h
lldb/include/lldb/Interpreter/OptionValueEnumeration.h
lldb/include/lldb/Interpreter/OptionValueFileColonLine.h
lldb/include/lldb/Interpreter/OptionValueFileSpec.h
lldb/include/lldb/Interpreter/OptionValueFileSpecList.h
lldb/include/lldb/Interpreter/OptionValueFormat.h
lldb/include/lldb/Interpreter/OptionValueFormatEntity.h
lldb/include/lldb/Interpreter/OptionValueLanguage.h
lldb/include/lldb/Interpreter/OptionValuePathMappings.h
lldb/include/lldb/Interpreter/OptionValueProperties.h
lldb/include/lldb/Interpreter/OptionValueSInt64.h
lldb/include/lldb/Interpreter/OptionValueString.h
lldb/include/lldb/Interpreter/OptionValueUInt64.h
lldb/include/lldb/Interpreter/OptionValueUUID.h
lldb/include/lldb/Interpreter/ScriptInterpreter.h
lldb/source/Interpreter/CommandHistory.cpp
lldb/source/Interpreter/CommandObject.cpp
lldb/source/Interpreter/CommandReturnObject.cpp
lldb/source/Interpreter/OptionGroupArchitecture.cpp
lldb/source/Interpreter/OptionGroupBoolean.cpp
lldb/source/Interpreter/OptionGroupFile.cpp
lldb/source/Interpreter/OptionGroupFormat.cpp
lldb/source/Interpreter/OptionGroupOutputFile.cpp
lldb/source/Interpreter/OptionGroupPythonClassWithDict.cpp
lldb/source/Interpreter/OptionGroupString.cpp
lldb/source/Interpreter/OptionGroupUInt64.cpp
lldb/source/Interpreter/OptionGroupUUID.cpp
lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp
lldb/source/Interpreter/OptionGroupVariable.cpp
lldb/source/Interpreter/OptionGroupWatchpoint.cpp
lldb/source/Interpreter/OptionValueEnumeration.cpp
lldb/source/Interpreter/Options.cpp
lldb/source/Interpreter/ScriptInterpreter.cpp

Removed: 




diff  --git a/lldb/include/lldb/Interpreter/CommandHistory.h 
b/lldb/include/lldb/Interpreter/CommandHistory.h
index fbb42247f11a..12c170ba5eeb 100644
--- a/lldb/include/lldb/Interpreter/CommandHistory.h
+++ b/lldb/include/lldb/Interpreter/CommandHistory.h
@@ -20,9 +20,9 @@ namespace lldb_private {
 
 class CommandHistory {
 public:
-  CommandHistory();
+  CommandHistory() = default;
 
-  ~CommandHistory();
+  ~CommandHistory() = default;
 
   size_t GetSize() const;
 

diff  --git a/lldb/include/lldb/Interpreter/CommandObject.h 
b/lldb/include/lldb/Interpreter/CommandObject.h
index d5ad969cda66..8bc5d3e22355 100644
--- a/lldb/include/lldb/Interpreter/CommandObject.h
+++ b/lldb/include/lldb/Interpreter/CommandObject.h
@@ -113,7 +113,7 @@ class CommandObject {
 llvm::StringRef help = "", llvm::StringRef syntax = "",
 uint32_t flags = 0);
 
-  virtual ~CommandObject();
+  virtual ~CommandObject() = default;
 
   static const char *
   GetArgumentTypeAsCString(const lldb::CommandArgumentType arg_type);

diff  --git a/lldb/include/lldb/Interpreter/CommandReturnObject.h 
b/lldb/include/lldb/Interpreter/CommandReturnObject.h
index 06b648517d13..c638b4bc70b2 100644
--- a/lldb/include/lldb/Interpreter/CommandReturnObject.h
+++ b/lldb/include/lldb/Interpreter/CommandReturnObject.h
@@ -26,7 +26,7 @@ class CommandReturnObject {
 public:
   CommandReturnObject(bool colors);
 
-  ~CommandReturnObject();
+  ~CommandReturnObject() = default;
 
   llvm::StringRef GetOutputData() {
 lldb::StreamSP 
stream_sp(m_out_stream.GetStreamAtIndex(eStreamStringIndex))

[Lldb-commits] [lldb] b2faf30 - [lldb][NFC] Make OptionValueArgs::GetArgs constant

2021-02-28 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2021-02-28T19:23:20+03:00
New Revision: b2faf30189449a894b5c1cb2bb6b0cc04986c7fe

URL: 
https://github.com/llvm/llvm-project/commit/b2faf30189449a894b5c1cb2bb6b0cc04986c7fe
DIFF: 
https://github.com/llvm/llvm-project/commit/b2faf30189449a894b5c1cb2bb6b0cc04986c7fe.diff

LOG: [lldb][NFC] Make OptionValueArgs::GetArgs constant

Added: 


Modified: 
lldb/include/lldb/Interpreter/OptionValueArgs.h
lldb/source/Interpreter/OptionValueArgs.cpp

Removed: 




diff  --git a/lldb/include/lldb/Interpreter/OptionValueArgs.h 
b/lldb/include/lldb/Interpreter/OptionValueArgs.h
index 2ef6ca5573e9..8cea8ced74de 100644
--- a/lldb/include/lldb/Interpreter/OptionValueArgs.h
+++ b/lldb/include/lldb/Interpreter/OptionValueArgs.h
@@ -21,7 +21,7 @@ class OptionValueArgs : public OptionValueArray {
 
   ~OptionValueArgs() override = default;
 
-  size_t GetArgs(Args &args);
+  size_t GetArgs(Args &args) const;
 
   Type GetType() const override { return eTypeArgs; }
 };

diff  --git a/lldb/source/Interpreter/OptionValueArgs.cpp 
b/lldb/source/Interpreter/OptionValueArgs.cpp
index 9e7774a231c7..bdb5f486835a 100644
--- a/lldb/source/Interpreter/OptionValueArgs.cpp
+++ b/lldb/source/Interpreter/OptionValueArgs.cpp
@@ -13,9 +13,9 @@
 using namespace lldb;
 using namespace lldb_private;
 
-size_t OptionValueArgs::GetArgs(Args &args) {
+size_t OptionValueArgs::GetArgs(Args &args) const {
   args.Clear();
-  for (auto value : m_values) {
+  for (const auto &value : m_values) {
 llvm::StringRef string_value = value->GetStringValue();
 if (!string_value.empty())
   args.AppendArgument(string_value);



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] ef447fe - [lldb] OptionValueProperties::Get[Set]PropertyAtIndexAsArgs should handle OptionValueArgs

2021-02-28 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2021-02-28T19:23:22+03:00
New Revision: ef447fe0088cacc38027028d4c43c1938d3eb9e7

URL: 
https://github.com/llvm/llvm-project/commit/ef447fe0088cacc38027028d4c43c1938d3eb9e7
DIFF: 
https://github.com/llvm/llvm-project/commit/ef447fe0088cacc38027028d4c43c1938d3eb9e7.diff

LOG: [lldb] OptionValueProperties::Get[Set]PropertyAtIndexAsArgs should handle 
OptionValueArgs

Added: 


Modified: 
lldb/source/Interpreter/OptionValueProperties.cpp

Removed: 




diff  --git a/lldb/source/Interpreter/OptionValueProperties.cpp 
b/lldb/source/Interpreter/OptionValueProperties.cpp
index 22447a82d811..886af3269a32 100644
--- a/lldb/source/Interpreter/OptionValueProperties.cpp
+++ b/lldb/source/Interpreter/OptionValueProperties.cpp
@@ -248,38 +248,50 @@ 
OptionValueProperties::GetPropertyAtIndexAsOptionValueLanguage(
 bool OptionValueProperties::GetPropertyAtIndexAsArgs(
 const ExecutionContext *exe_ctx, uint32_t idx, Args &args) const {
   const Property *property = GetPropertyAtIndex(exe_ctx, false, idx);
-  if (property) {
-OptionValue *value = property->GetValue().get();
-if (value) {
-  const OptionValueArray *array = value->GetAsArray();
-  if (array)
-return array->GetArgs(args);
-  else {
-const OptionValueDictionary *dict = value->GetAsDictionary();
-if (dict)
-  return dict->GetArgs(args);
-  }
-}
-  }
+  if (!property)
+return false;
+
+  OptionValue *value = property->GetValue().get();
+  if (!value)
+return false;
+
+  const OptionValueArgs *arguments = value->GetAsArgs();
+  if (arguments)
+return arguments->GetArgs(args);
+
+  const OptionValueArray *array = value->GetAsArray();
+  if (array)
+return array->GetArgs(args);
+
+  const OptionValueDictionary *dict = value->GetAsDictionary();
+  if (dict)
+return dict->GetArgs(args);
+
   return false;
 }
 
 bool OptionValueProperties::SetPropertyAtIndexFromArgs(
 const ExecutionContext *exe_ctx, uint32_t idx, const Args &args) {
   const Property *property = GetPropertyAtIndex(exe_ctx, true, idx);
-  if (property) {
-OptionValue *value = property->GetValue().get();
-if (value) {
-  OptionValueArray *array = value->GetAsArray();
-  if (array)
-return array->SetArgs(args, eVarSetOperationAssign).Success();
-  else {
-OptionValueDictionary *dict = value->GetAsDictionary();
-if (dict)
-  return dict->SetArgs(args, eVarSetOperationAssign).Success();
-  }
-}
-  }
+  if (!property)
+return false;
+
+  OptionValue *value = property->GetValue().get();
+  if (!value)
+return false;
+
+  OptionValueArgs *arguments = value->GetAsArgs();
+  if (arguments)
+return arguments->SetArgs(args, eVarSetOperationAssign).Success();
+
+  OptionValueArray *array = value->GetAsArray();
+  if (array)
+return array->SetArgs(args, eVarSetOperationAssign).Success();
+
+  OptionValueDictionary *dict = value->GetAsDictionary();
+  if (dict)
+return dict->SetArgs(args, eVarSetOperationAssign).Success();
+
   return false;
 }
 



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 9182117 - [lldb/Interpreter][NFC] Remove more deleted const char* overloads

2021-02-28 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2021-02-28T19:23:14+03:00
New Revision: 9182117861896a03499bbca3612fc66ca4d36944

URL: 
https://github.com/llvm/llvm-project/commit/9182117861896a03499bbca3612fc66ca4d36944
DIFF: 
https://github.com/llvm/llvm-project/commit/9182117861896a03499bbca3612fc66ca4d36944.diff

LOG: [lldb/Interpreter][NFC] Remove more deleted const char* overloads

A follow-up commit to D96861.

Added: 


Modified: 
lldb/include/lldb/Interpreter/OptionGroupBoolean.h
lldb/include/lldb/Interpreter/OptionGroupFile.h
lldb/include/lldb/Interpreter/OptionGroupPythonClassWithDict.h
lldb/include/lldb/Interpreter/OptionGroupString.h
lldb/include/lldb/Interpreter/OptionGroupUInt64.h
lldb/include/lldb/Interpreter/OptionGroupUUID.h
lldb/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h
lldb/include/lldb/Interpreter/OptionGroupVariable.h
lldb/include/lldb/Interpreter/OptionGroupWatchpoint.h
lldb/include/lldb/Interpreter/OptionValueString.h
lldb/include/lldb/Interpreter/OptionValueUInt64.h

Removed: 




diff  --git a/lldb/include/lldb/Interpreter/OptionGroupBoolean.h 
b/lldb/include/lldb/Interpreter/OptionGroupBoolean.h
index 061e31340854..5411e99148e6 100644
--- a/lldb/include/lldb/Interpreter/OptionGroupBoolean.h
+++ b/lldb/include/lldb/Interpreter/OptionGroupBoolean.h
@@ -33,7 +33,6 @@ class OptionGroupBoolean : public OptionGroup {
 
   Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
 ExecutionContext *execution_context) override;
-  Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
 
   void OptionParsingStarting(ExecutionContext *execution_context) override;
 

diff  --git a/lldb/include/lldb/Interpreter/OptionGroupFile.h 
b/lldb/include/lldb/Interpreter/OptionGroupFile.h
index 374cf10ea30a..22b0eb4a28fa 100644
--- a/lldb/include/lldb/Interpreter/OptionGroupFile.h
+++ b/lldb/include/lldb/Interpreter/OptionGroupFile.h
@@ -32,7 +32,6 @@ class OptionGroupFile : public OptionGroup {
 
   Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
 ExecutionContext *execution_context) override;
-  Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
 
   void OptionParsingStarting(ExecutionContext *execution_context) override;
 
@@ -63,7 +62,6 @@ class OptionGroupFileList : public OptionGroup {
 
   Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
 ExecutionContext *execution_context) override;
-  Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
 
   void OptionParsingStarting(ExecutionContext *execution_context) override;
 

diff  --git a/lldb/include/lldb/Interpreter/OptionGroupPythonClassWithDict.h 
b/lldb/include/lldb/Interpreter/OptionGroupPythonClassWithDict.h
index d4c924a44157..695a5b93c2ea 100644
--- a/lldb/include/lldb/Interpreter/OptionGroupPythonClassWithDict.h
+++ b/lldb/include/lldb/Interpreter/OptionGroupPythonClassWithDict.h
@@ -37,7 +37,6 @@ class OptionGroupPythonClassWithDict : public OptionGroup {
 
   Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
 ExecutionContext *execution_context) override;
-  Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
 
   void OptionParsingStarting(ExecutionContext *execution_context) override;
   Status OptionParsingFinished(ExecutionContext *execution_context) override;

diff  --git a/lldb/include/lldb/Interpreter/OptionGroupString.h 
b/lldb/include/lldb/Interpreter/OptionGroupString.h
index 1a3b5bdd88ed..de1ef0b4bf3c 100644
--- a/lldb/include/lldb/Interpreter/OptionGroupString.h
+++ b/lldb/include/lldb/Interpreter/OptionGroupString.h
@@ -30,7 +30,6 @@ class OptionGroupString : public OptionGroup {
 
   Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
 ExecutionContext *execution_context) override;
-  Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
 
   void OptionParsingStarting(ExecutionContext *execution_context) override;
 

diff  --git a/lldb/include/lldb/Interpreter/OptionGroupUInt64.h 
b/lldb/include/lldb/Interpreter/OptionGroupUInt64.h
index 783c4b632f00..1e21f56d4338 100644
--- a/lldb/include/lldb/Interpreter/OptionGroupUInt64.h
+++ b/lldb/include/lldb/Interpreter/OptionGroupUInt64.h
@@ -31,7 +31,6 @@ class OptionGroupUInt64 : public OptionGroup {
 
   Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
 ExecutionContext *execution_context) override;
-  Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
 
   void OptionParsingStarting(ExecutionContext *execution_context) override;
 

diff  --git a/lldb/include/lldb/Interpreter/OptionGroupUUID.h 
b/lldb/include/lldb/Interpreter/OptionGroupU

[Lldb-commits] [lldb] f0f183e - [lldb/Interpreter] Fix deep copying for OptionValue classes

2021-02-28 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2021-02-28T19:23:25+03:00
New Revision: f0f183ee4ad952d94234cf6971c69a044e05c9df

URL: 
https://github.com/llvm/llvm-project/commit/f0f183ee4ad952d94234cf6971c69a044e05c9df
DIFF: 
https://github.com/llvm/llvm-project/commit/f0f183ee4ad952d94234cf6971c69a044e05c9df.diff

LOG: [lldb/Interpreter] Fix deep copying for OptionValue classes

Some implementations of the DeepCopy function called the copy constructor that 
copied m_parent member instead of setting a new parent. Others just leaved the 
base class's members (m_parent, m_callback, m_was_set) empty.
One more problem is that not all classes override this function, e.g. 
OptionValueArgs::DeepCopy produces OptionValueArray instance, and 
Target[Process/Thread]ValueProperty::DeepCopy produces OptionValueProperty. 
This makes downcasting via static_cast invalid.

The patch implements idiom "virtual constructor" to fix these issues.
Add a test that checks DeepCopy for correct copying/setting all data members of 
the base class.

Differential Revision: https://reviews.llvm.org/D96952

Added: 
lldb/include/lldb/Utility/Cloneable.h
lldb/unittests/Interpreter/TestOptionValue.cpp

Modified: 
lldb/include/lldb/Interpreter/OptionValue.h
lldb/include/lldb/Interpreter/OptionValueArch.h
lldb/include/lldb/Interpreter/OptionValueArgs.h
lldb/include/lldb/Interpreter/OptionValueArray.h
lldb/include/lldb/Interpreter/OptionValueBoolean.h
lldb/include/lldb/Interpreter/OptionValueChar.h
lldb/include/lldb/Interpreter/OptionValueDictionary.h
lldb/include/lldb/Interpreter/OptionValueEnumeration.h
lldb/include/lldb/Interpreter/OptionValueFileColonLine.h
lldb/include/lldb/Interpreter/OptionValueFileSpec.h
lldb/include/lldb/Interpreter/OptionValueFileSpecList.h
lldb/include/lldb/Interpreter/OptionValueFormat.h
lldb/include/lldb/Interpreter/OptionValueFormatEntity.h
lldb/include/lldb/Interpreter/OptionValueLanguage.h
lldb/include/lldb/Interpreter/OptionValuePathMappings.h
lldb/include/lldb/Interpreter/OptionValueProperties.h
lldb/include/lldb/Interpreter/OptionValueRegex.h
lldb/include/lldb/Interpreter/OptionValueSInt64.h
lldb/include/lldb/Interpreter/OptionValueString.h
lldb/include/lldb/Interpreter/OptionValueUInt64.h
lldb/include/lldb/Interpreter/OptionValueUUID.h
lldb/source/Interpreter/OptionValue.cpp
lldb/source/Interpreter/OptionValueArch.cpp
lldb/source/Interpreter/OptionValueArray.cpp
lldb/source/Interpreter/OptionValueBoolean.cpp
lldb/source/Interpreter/OptionValueChar.cpp
lldb/source/Interpreter/OptionValueDictionary.cpp
lldb/source/Interpreter/OptionValueEnumeration.cpp
lldb/source/Interpreter/OptionValueFileColonLine.cpp
lldb/source/Interpreter/OptionValueFileSpec.cpp
lldb/source/Interpreter/OptionValueFileSpecList.cpp
lldb/source/Interpreter/OptionValueFormat.cpp
lldb/source/Interpreter/OptionValueFormatEntity.cpp
lldb/source/Interpreter/OptionValueLanguage.cpp
lldb/source/Interpreter/OptionValuePathMappings.cpp
lldb/source/Interpreter/OptionValueProperties.cpp
lldb/source/Interpreter/OptionValueRegex.cpp
lldb/source/Interpreter/OptionValueSInt64.cpp
lldb/source/Interpreter/OptionValueString.cpp
lldb/source/Interpreter/OptionValueUInt64.cpp
lldb/source/Interpreter/OptionValueUUID.cpp
lldb/source/Target/Process.cpp
lldb/source/Target/Target.cpp
lldb/source/Target/Thread.cpp
lldb/test/API/commands/settings/TestSettings.py
lldb/unittests/Interpreter/CMakeLists.txt

Removed: 




diff  --git a/lldb/include/lldb/Interpreter/OptionValue.h 
b/lldb/include/lldb/Interpreter/OptionValue.h
index a8176e39940a..218fa6f029c1 100644
--- a/lldb/include/lldb/Interpreter/OptionValue.h
+++ b/lldb/include/lldb/Interpreter/OptionValue.h
@@ -10,6 +10,7 @@
 #define LLDB_INTERPRETER_OPTIONVALUE_H
 
 #include "lldb/Core/FormatEntity.h"
+#include "lldb/Utility/Cloneable.h"
 #include "lldb/Utility/CompletionRequest.h"
 #include "lldb/Utility/ConstString.h"
 #include "lldb/Utility/Status.h"
@@ -87,7 +88,8 @@ class OptionValue {
 
   virtual void Clear() = 0;
 
-  virtual lldb::OptionValueSP DeepCopy() const = 0;
+  virtual lldb::OptionValueSP
+  DeepCopy(const lldb::OptionValueSP &new_parent) const;
 
   virtual void AutoComplete(CommandInterpreter &interpreter,
 CompletionRequest &request);
@@ -306,6 +308,8 @@ class OptionValue {
 m_parent_wp = parent_sp;
   }
 
+  lldb::OptionValueSP GetParent() const { return m_parent_wp.lock(); }
+
   void SetValueChangedCallback(std::function callback) {
 assert(!m_callback);
 m_callback = std::move(callback);
@@ -317,6 +321,12 @@ class OptionValue {
   }
 
 protected:
+  using TopmostBase = OptionValue;
+
+  // Must be overriden by a derived class for correct downcasting the result of
+  // DeepCopy to it. Inherit f

[Lldb-commits] [lldb] 1d6a6f3 - [lldb/Target] Remove outdated code

2021-02-28 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2021-02-28T19:23:27+03:00
New Revision: 1d6a6f3b0c710ccd6558644d195cf939c4995d84

URL: 
https://github.com/llvm/llvm-project/commit/1d6a6f3b0c710ccd6558644d195cf939c4995d84
DIFF: 
https://github.com/llvm/llvm-project/commit/1d6a6f3b0c710ccd6558644d195cf939c4995d84.diff

LOG: [lldb/Target] Remove outdated code

Arg0 callback does work.

Added: 


Modified: 
lldb/include/lldb/Target/Target.h
lldb/source/Target/Target.cpp

Removed: 




diff  --git a/lldb/include/lldb/Target/Target.h 
b/lldb/include/lldb/Target/Target.h
index f35f4e9a44f1..737efaf30882 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -211,7 +211,7 @@ class TargetProperties : public Properties {
 
   void SetDisplayRecognizedArguments(bool b);
 
-  const ProcessLaunchInfo &GetProcessLaunchInfo();
+  const ProcessLaunchInfo &GetProcessLaunchInfo() const;
 
   void SetProcessLaunchInfo(const ProcessLaunchInfo &launch_info);
 

diff  --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 6cf9d54c7751..98f63a81ea17 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -4196,8 +4196,7 @@ void TargetProperties::SetNonStopModeEnabled(bool b) {
   m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b);
 }
 
-const ProcessLaunchInfo &TargetProperties::GetProcessLaunchInfo() {
-  m_launch_info.SetArg0(GetArg0()); // FIXME: Arg0 callback doesn't work
+const ProcessLaunchInfo &TargetProperties::GetProcessLaunchInfo() const {
   return m_launch_info;
 }
 



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D96952: CRTP-based version of D96817

2021-02-28 Thread Tatyana Krasnukha via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
tatyana-krasnukha marked 2 inline comments as done.
Closed by commit rGf0f183ee4ad9: [lldb/Interpreter] Fix deep copying for 
OptionValue classes (authored by tatyana-krasnukha).
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Changed prior to commit:
  https://reviews.llvm.org/D96952?vs=325093&id=326971#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96952/new/

https://reviews.llvm.org/D96952

Files:
  lldb/include/lldb/Interpreter/OptionValue.h
  lldb/include/lldb/Interpreter/OptionValueArch.h
  lldb/include/lldb/Interpreter/OptionValueArgs.h
  lldb/include/lldb/Interpreter/OptionValueArray.h
  lldb/include/lldb/Interpreter/OptionValueBoolean.h
  lldb/include/lldb/Interpreter/OptionValueChar.h
  lldb/include/lldb/Interpreter/OptionValueDictionary.h
  lldb/include/lldb/Interpreter/OptionValueEnumeration.h
  lldb/include/lldb/Interpreter/OptionValueFileColonLine.h
  lldb/include/lldb/Interpreter/OptionValueFileSpec.h
  lldb/include/lldb/Interpreter/OptionValueFileSpecList.h
  lldb/include/lldb/Interpreter/OptionValueFormat.h
  lldb/include/lldb/Interpreter/OptionValueFormatEntity.h
  lldb/include/lldb/Interpreter/OptionValueLanguage.h
  lldb/include/lldb/Interpreter/OptionValuePathMappings.h
  lldb/include/lldb/Interpreter/OptionValueProperties.h
  lldb/include/lldb/Interpreter/OptionValueRegex.h
  lldb/include/lldb/Interpreter/OptionValueSInt64.h
  lldb/include/lldb/Interpreter/OptionValueString.h
  lldb/include/lldb/Interpreter/OptionValueUInt64.h
  lldb/include/lldb/Interpreter/OptionValueUUID.h
  lldb/include/lldb/Utility/Cloneable.h
  lldb/source/Interpreter/OptionValue.cpp
  lldb/source/Interpreter/OptionValueArch.cpp
  lldb/source/Interpreter/OptionValueArray.cpp
  lldb/source/Interpreter/OptionValueBoolean.cpp
  lldb/source/Interpreter/OptionValueChar.cpp
  lldb/source/Interpreter/OptionValueDictionary.cpp
  lldb/source/Interpreter/OptionValueEnumeration.cpp
  lldb/source/Interpreter/OptionValueFileColonLine.cpp
  lldb/source/Interpreter/OptionValueFileSpec.cpp
  lldb/source/Interpreter/OptionValueFileSpecList.cpp
  lldb/source/Interpreter/OptionValueFormat.cpp
  lldb/source/Interpreter/OptionValueFormatEntity.cpp
  lldb/source/Interpreter/OptionValueLanguage.cpp
  lldb/source/Interpreter/OptionValuePathMappings.cpp
  lldb/source/Interpreter/OptionValueProperties.cpp
  lldb/source/Interpreter/OptionValueRegex.cpp
  lldb/source/Interpreter/OptionValueSInt64.cpp
  lldb/source/Interpreter/OptionValueString.cpp
  lldb/source/Interpreter/OptionValueUInt64.cpp
  lldb/source/Interpreter/OptionValueUUID.cpp
  lldb/source/Target/Process.cpp
  lldb/source/Target/Target.cpp
  lldb/source/Target/Thread.cpp
  lldb/test/API/commands/settings/TestSettings.py
  lldb/unittests/Interpreter/CMakeLists.txt
  lldb/unittests/Interpreter/TestOptionValue.cpp

Index: lldb/unittests/Interpreter/TestOptionValue.cpp
===
--- /dev/null
+++ lldb/unittests/Interpreter/TestOptionValue.cpp
@@ -0,0 +1,173 @@
+//===-- TestOptionValue.cpp ---===//
+//
+// 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
+//
+//===--===//
+
+#include "lldb/Interpreter/OptionValues.h"
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+using namespace lldb_private;
+
+class Callback {
+public:
+  virtual void Invoke() const {}
+  void operator()() const { Invoke(); }
+};
+
+class MockCallback : public Callback {
+public:
+  MOCK_CONST_METHOD0(Invoke, void());
+};
+
+// Test a single-value class.
+TEST(OptionValueString, DeepCopy) {
+  OptionValueString str;
+  str.SetValueFromString("ab");
+
+  MockCallback callback;
+  str.SetValueChangedCallback([&callback] { callback(); });
+  EXPECT_CALL(callback, Invoke());
+
+  auto copy_sp = str.DeepCopy(nullptr);
+
+  // Test that the base class data members are copied/set correctly.
+  ASSERT_TRUE(copy_sp);
+  ASSERT_EQ(copy_sp->GetParent().get(), nullptr);
+  ASSERT_TRUE(copy_sp->OptionWasSet());
+  ASSERT_EQ(copy_sp->GetStringValue(), "ab");
+
+  // Trigger the callback.
+  copy_sp->SetValueFromString("c", eVarSetOperationAppend);
+  ASSERT_EQ(copy_sp->GetStringValue(), "abc");
+}
+
+// Test an aggregate class.
+TEST(OptionValueArgs, DeepCopy) {
+  OptionValueArgs args;
+  args.SetValueFromString("A B");
+
+  MockCallback callback;
+  args.SetValueChangedCallback([&callback] { callback(); });
+  EXPECT_CALL(callback, Invoke());
+
+  auto copy_sp = args.DeepCopy(nullptr);
+
+  // Test that the base class data members are copied/set correctly.
+  ASSERT_TRUE(copy_sp);
+  ASSERT_EQ(copy_sp->GetParent(), nullptr);
+  ASSERT_TRUE(copy_sp->Optio

[Lldb-commits] [PATCH] D96952: CRTP-based version of D96817

2021-02-28 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha added inline comments.



Comment at: lldb/source/Interpreter/OptionValueFileSpecList.cpp:169
   std::lock_guard lock(m_mutex);
-  return OptionValueSP(new OptionValueFileSpecList(m_current_value));
+  return std::make_shared(*this);
 }

JDevlieghere wrote:
> I would call the `Clone` from `Cloneable` here, it's a bit messy with the 
> templates but it makes it makes it clear we're not hand-rolling an 
> implementation but instead are just protecting it wiht a mutex. 
Thanks! Did this before landing.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96952/new/

https://reviews.llvm.org/D96952

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D96817: Fix deep copying for OptionValue classes

2021-02-28 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha abandoned this revision.
tatyana-krasnukha added a comment.

D96952  is landed instead.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96817/new/

https://reviews.llvm.org/D96817

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] 54d03a4 - [lldb/Interpreter][NFC] Replace default constructors/destructors bodies with "=default"

2021-02-28 Thread David Blaikie via lldb-commits
Any chance of removing some of these entirely, when they're the default
(like the first class in this patch, `CommandHistory` - a default ctor
(assuming it has no other ctors) and dtor are implicit, and don't need to
be written out)?

On Sun, Feb 28, 2021 at 8:24 AM Tatyana Krasnukha via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

>
> Author: Tatyana Krasnukha
> Date: 2021-02-28T19:23:16+03:00
> New Revision: 54d03a4985bc9a0a84c4dff835ec6ed0f607582f
>
> URL:
> https://github.com/llvm/llvm-project/commit/54d03a4985bc9a0a84c4dff835ec6ed0f607582f
> DIFF:
> https://github.com/llvm/llvm-project/commit/54d03a4985bc9a0a84c4dff835ec6ed0f607582f.diff
>
> LOG: [lldb/Interpreter][NFC] Replace default constructors/destructors
> bodies with "=default"
>
> Added:
>
>
> Modified:
> lldb/include/lldb/Interpreter/CommandHistory.h
> lldb/include/lldb/Interpreter/CommandObject.h
> lldb/include/lldb/Interpreter/CommandReturnObject.h
> lldb/include/lldb/Interpreter/OptionGroupArchitecture.h
> lldb/include/lldb/Interpreter/OptionGroupBoolean.h
> lldb/include/lldb/Interpreter/OptionGroupFile.h
> lldb/include/lldb/Interpreter/OptionGroupFormat.h
> lldb/include/lldb/Interpreter/OptionGroupOutputFile.h
> lldb/include/lldb/Interpreter/OptionGroupPythonClassWithDict.h
> lldb/include/lldb/Interpreter/OptionGroupString.h
> lldb/include/lldb/Interpreter/OptionGroupUInt64.h
> lldb/include/lldb/Interpreter/OptionGroupUUID.h
> lldb/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h
> lldb/include/lldb/Interpreter/OptionGroupVariable.h
> lldb/include/lldb/Interpreter/OptionGroupWatchpoint.h
> lldb/include/lldb/Interpreter/OptionValueArch.h
> lldb/include/lldb/Interpreter/OptionValueArgs.h
> lldb/include/lldb/Interpreter/OptionValueArray.h
> lldb/include/lldb/Interpreter/OptionValueBoolean.h
> lldb/include/lldb/Interpreter/OptionValueChar.h
> lldb/include/lldb/Interpreter/OptionValueDictionary.h
> lldb/include/lldb/Interpreter/OptionValueEnumeration.h
> lldb/include/lldb/Interpreter/OptionValueFileColonLine.h
> lldb/include/lldb/Interpreter/OptionValueFileSpec.h
> lldb/include/lldb/Interpreter/OptionValueFileSpecList.h
> lldb/include/lldb/Interpreter/OptionValueFormat.h
> lldb/include/lldb/Interpreter/OptionValueFormatEntity.h
> lldb/include/lldb/Interpreter/OptionValueLanguage.h
> lldb/include/lldb/Interpreter/OptionValuePathMappings.h
> lldb/include/lldb/Interpreter/OptionValueProperties.h
> lldb/include/lldb/Interpreter/OptionValueSInt64.h
> lldb/include/lldb/Interpreter/OptionValueString.h
> lldb/include/lldb/Interpreter/OptionValueUInt64.h
> lldb/include/lldb/Interpreter/OptionValueUUID.h
> lldb/include/lldb/Interpreter/ScriptInterpreter.h
> lldb/source/Interpreter/CommandHistory.cpp
> lldb/source/Interpreter/CommandObject.cpp
> lldb/source/Interpreter/CommandReturnObject.cpp
> lldb/source/Interpreter/OptionGroupArchitecture.cpp
> lldb/source/Interpreter/OptionGroupBoolean.cpp
> lldb/source/Interpreter/OptionGroupFile.cpp
> lldb/source/Interpreter/OptionGroupFormat.cpp
> lldb/source/Interpreter/OptionGroupOutputFile.cpp
> lldb/source/Interpreter/OptionGroupPythonClassWithDict.cpp
> lldb/source/Interpreter/OptionGroupString.cpp
> lldb/source/Interpreter/OptionGroupUInt64.cpp
> lldb/source/Interpreter/OptionGroupUUID.cpp
> lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp
> lldb/source/Interpreter/OptionGroupVariable.cpp
> lldb/source/Interpreter/OptionGroupWatchpoint.cpp
> lldb/source/Interpreter/OptionValueEnumeration.cpp
> lldb/source/Interpreter/Options.cpp
> lldb/source/Interpreter/ScriptInterpreter.cpp
>
> Removed:
>
>
>
>
> 
> diff  --git a/lldb/include/lldb/Interpreter/CommandHistory.h
> b/lldb/include/lldb/Interpreter/CommandHistory.h
> index fbb42247f11a..12c170ba5eeb 100644
> --- a/lldb/include/lldb/Interpreter/CommandHistory.h
> +++ b/lldb/include/lldb/Interpreter/CommandHistory.h
> @@ -20,9 +20,9 @@ namespace lldb_private {
>
>  class CommandHistory {
>  public:
> -  CommandHistory();
> +  CommandHistory() = default;
>
> -  ~CommandHistory();
> +  ~CommandHistory() = default;
>
>size_t GetSize() const;
>
>
> diff  --git a/lldb/include/lldb/Interpreter/CommandObject.h
> b/lldb/include/lldb/Interpreter/CommandObject.h
> index d5ad969cda66..8bc5d3e22355 100644
> --- a/lldb/include/lldb/Interpreter/CommandObject.h
> +++ b/lldb/include/lldb/Interpreter/CommandObject.h
> @@ -113,7 +113,7 @@ class CommandObject {
>  llvm::StringRef help = "", llvm::StringRef syntax = "",
>  uint32_t flags = 0);
>
> -  virtual ~CommandObject();
> +  virtual ~CommandObject() = default;
>
>static const char *
>GetArgumentTypeAsCString(const lldb::CommandArgumentType arg_type);
>
> diff  --git a/lldb/include/lldb/

Re: [Lldb-commits] [lldb] 8cdcd41 - [lldb/Interpreter][NFC] Remove explicit default initialization of members and base classes

2021-02-28 Thread David Blaikie via lldb-commits
Nice cleanup!

On Sun, Feb 28, 2021 at 8:24 AM Tatyana Krasnukha via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

>
> Author: Tatyana Krasnukha
> Date: 2021-02-28T19:23:18+03:00
> New Revision: 8cdcd41e384b4901cd796f7be58c461647e54d18
>
> URL:
> https://github.com/llvm/llvm-project/commit/8cdcd41e384b4901cd796f7be58c461647e54d18
> DIFF:
> https://github.com/llvm/llvm-project/commit/8cdcd41e384b4901cd796f7be58c461647e54d18.diff
>
> LOG: [lldb/Interpreter][NFC] Remove explicit default initialization of
> members and base classes
>
> According to clang-tidy's readability-redundant-member-init.
>
> Added:
>
>
> Modified:
> lldb/include/lldb/Interpreter/OptionGroupPlatform.h
> lldb/include/lldb/Interpreter/OptionValueArch.h
> lldb/include/lldb/Interpreter/OptionValueBoolean.h
> lldb/include/lldb/Interpreter/OptionValueChar.h
> lldb/include/lldb/Interpreter/OptionValueDictionary.h
> lldb/include/lldb/Interpreter/OptionValueFileSpecList.h
> lldb/include/lldb/Interpreter/OptionValueFormat.h
> lldb/include/lldb/Interpreter/OptionValueLanguage.h
> lldb/include/lldb/Interpreter/OptionValuePathMappings.h
> lldb/include/lldb/Interpreter/OptionValueRegex.h
> lldb/include/lldb/Interpreter/OptionValueSInt64.h
> lldb/include/lldb/Interpreter/OptionValueString.h
> lldb/include/lldb/Interpreter/OptionValueUInt64.h
> lldb/include/lldb/Interpreter/OptionValueUUID.h
> lldb/include/lldb/Interpreter/Options.h
> lldb/source/Interpreter/CommandAlias.cpp
> lldb/source/Interpreter/CommandInterpreter.cpp
> lldb/source/Interpreter/CommandObject.cpp
> lldb/source/Interpreter/OptionGroupFile.cpp
> lldb/source/Interpreter/OptionGroupOutputFile.cpp
> lldb/source/Interpreter/OptionGroupPythonClassWithDict.cpp
> lldb/source/Interpreter/OptionGroupVariable.cpp
> lldb/source/Interpreter/OptionValueEnumeration.cpp
> lldb/source/Interpreter/OptionValueFileColonLine.cpp
> lldb/source/Interpreter/OptionValueFileSpec.cpp
> lldb/source/Interpreter/OptionValueFormatEntity.cpp
> lldb/source/Interpreter/OptionValueProperties.cpp
> lldb/source/Interpreter/Options.cpp
> lldb/source/Interpreter/Property.cpp
>
> Removed:
>
>
>
>
> 
> diff  --git a/lldb/include/lldb/Interpreter/OptionGroupPlatform.h
> b/lldb/include/lldb/Interpreter/OptionGroupPlatform.h
> index 99945e5246fd..fed2791a6130 100644
> --- a/lldb/include/lldb/Interpreter/OptionGroupPlatform.h
> +++ b/lldb/include/lldb/Interpreter/OptionGroupPlatform.h
> @@ -21,8 +21,7 @@ namespace lldb_private {
>  class OptionGroupPlatform : public OptionGroup {
>  public:
>OptionGroupPlatform(bool include_platform_option)
> -  : OptionGroup(), m_platform_name(), m_sdk_sysroot(),
> -m_include_platform_option(include_platform_option) {}
> +  : m_include_platform_option(include_platform_option) {}
>
>~OptionGroupPlatform() override = default;
>
>
> diff  --git a/lldb/include/lldb/Interpreter/OptionValueArch.h
> b/lldb/include/lldb/Interpreter/OptionValueArch.h
> index d079b3896531..22f75a6259c5 100644
> --- a/lldb/include/lldb/Interpreter/OptionValueArch.h
> +++ b/lldb/include/lldb/Interpreter/OptionValueArch.h
> @@ -19,17 +19,15 @@ class OptionValueArch : public OptionValue {
>  public:
>OptionValueArch() = default;
>
> -  OptionValueArch(const char *triple)
> -  : OptionValue(), m_current_value(triple), m_default_value() {
> +  OptionValueArch(const char *triple) : m_current_value(triple) {
>  m_default_value = m_current_value;
>}
>
>OptionValueArch(const ArchSpec &value)
> -  : OptionValue(), m_current_value(value), m_default_value(value) {}
> +  : m_current_value(value), m_default_value(value) {}
>
>OptionValueArch(const ArchSpec ¤t_value, const ArchSpec
> &default_value)
> -  : OptionValue(), m_current_value(current_value),
> -m_default_value(default_value) {}
> +  : m_current_value(current_value), m_default_value(default_value) {}
>
>~OptionValueArch() override = default;
>
>
> diff  --git a/lldb/include/lldb/Interpreter/OptionValueBoolean.h
> b/lldb/include/lldb/Interpreter/OptionValueBoolean.h
> index d0eb4362d466..6ae464bd8fb2 100644
> --- a/lldb/include/lldb/Interpreter/OptionValueBoolean.h
> +++ b/lldb/include/lldb/Interpreter/OptionValueBoolean.h
> @@ -16,10 +16,9 @@ namespace lldb_private {
>  class OptionValueBoolean : public OptionValue {
>  public:
>OptionValueBoolean(bool value)
> -  : OptionValue(), m_current_value(value), m_default_value(value) {}
> +  : m_current_value(value), m_default_value(value) {}
>OptionValueBoolean(bool current_value, bool default_value)
> -  : OptionValue(), m_current_value(current_value),
> -m_default_value(default_value) {}
> +  : m_current_value(current_value), m_default_value(default_value) {}
>
>~OptionValueBoolean() override = default;
>
>
> diff  --git 

[Lldb-commits] [PATCH] D97644: Allow RegisterContext to track if behaves-like-frame-0, allow LanguageRuntime for above frame 0

2021-02-28 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda created this revision.
jasonmolenda added a reviewer: clayborg.
jasonmolenda added a project: LLDB.
Herald added a subscriber: JDevlieghere.
jasonmolenda requested review of this revision.

This patch allows a RegisterContext to record if it behaves like a 0th frame -- 
where its pc value should not be decremented before symbolication.  It adds a 
call out to the LanguageRuntime to get a special UnwindPlan when unwinding from 
the 0th (first) frame, not just further unwinds up the stack.  The majority of 
the patch is the mechanical addition of the new ivar/method to expose this, and 
the LanguageRuntime hook in InitializeZerothFrame(). This is a follow-on patch 
to the previous https://reviews.llvm.org/D96839

For the Swift async unwinds, the saved pc values we have are not normal ABI 
style calls, and backing up the resume pc results in bad symbolication.   I've 
been meaning to add a capability like this to RegisterContext for a while for 
DWARFExpression::Evaluate where we get a frame's pc value to look up a location 
list entry too (and do not decr the pc resulting in bogus values being 
displayed for noreturn calls) - I'll fix that in a separate patch.

I have API tests when the Swift language runtime is present, but in generic 
lldb we don't have an environment quite like this.  In the followup patch to 
DWARFExpression::Evaluate I'll be able to test 
RegisterContext::BehavesLikeZerothFrame so there will be some test coverage 
then.

rdar://problem/70398009


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97644

Files:
  lldb/include/lldb/Target/LanguageRuntime.h
  lldb/include/lldb/Target/RegisterContext.h
  lldb/include/lldb/Target/RegisterContextUnwind.h
  lldb/source/Target/LanguageRuntime.cpp
  lldb/source/Target/RegisterContextUnwind.cpp
  lldb/source/Target/StackFrameList.cpp
  lldb/source/Target/UnwindLLDB.cpp

Index: lldb/source/Target/UnwindLLDB.cpp
===
--- lldb/source/Target/UnwindLLDB.cpp
+++ lldb/source/Target/UnwindLLDB.cpp
@@ -420,6 +420,8 @@
   // too behaves like the zeroth frame (i.e. the pc might not
   // be pointing just past a call in it)
   behaves_like_zeroth_frame = true;
+} else if (m_frames[idx]->reg_ctx_lldb_sp->BehavesLikeZerothFrame()) {
+  behaves_like_zeroth_frame = true;
 } else {
   behaves_like_zeroth_frame = false;
 }
Index: lldb/source/Target/StackFrameList.cpp
===
--- lldb/source/Target/StackFrameList.cpp
+++ lldb/source/Target/StackFrameList.cpp
@@ -529,7 +529,7 @@
   // used to lookup the symbol context above. If we are in the first
   // concrete frame, then we lookup using the current address, else we
   // decrement the address by one to get the correct location.
-  if (idx > 0) {
+  if (idx > 0 && !behaves_like_zeroth_frame) {
 if (curr_frame_address.GetOffset() == 0) {
   // If curr_frame_address points to the first address in a section
   // then after adjustment it will point to an other section. In that
Index: lldb/source/Target/RegisterContextUnwind.cpp
===
--- lldb/source/Target/RegisterContextUnwind.cpp
+++ lldb/source/Target/RegisterContextUnwind.cpp
@@ -58,10 +58,11 @@
   m_fast_unwind_plan_sp(), m_full_unwind_plan_sp(),
   m_fallback_unwind_plan_sp(), m_all_registers_available(false),
   m_frame_type(-1), m_cfa(LLDB_INVALID_ADDRESS),
-  m_afa(LLDB_INVALID_ADDRESS), m_start_pc(),
-  m_current_pc(), m_current_offset(0), m_current_offset_backed_up_one(0),
-  m_sym_ctx(sym_ctx), m_sym_ctx_valid(false), m_frame_number(frame_number),
-  m_registers(), m_parent_unwind(unwind_lldb) {
+  m_afa(LLDB_INVALID_ADDRESS), m_start_pc(), m_current_pc(),
+  m_current_offset(0), m_current_offset_backed_up_one(0),
+  m_behaves_like_zeroth_frame(false), m_sym_ctx(sym_ctx),
+  m_sym_ctx_valid(false), m_frame_number(frame_number), m_registers(),
+  m_parent_unwind(unwind_lldb) {
   m_sym_ctx.Clear(false);
   m_sym_ctx_valid = false;
 
@@ -140,6 +141,12 @@
   if (abi)
 current_pc = abi->FixCodeAddress(current_pc);
 
+  UnwindPlanSP lang_runtime_plan_sp = LanguageRuntime::GetRuntimeUnwindPlan(
+  m_thread, this, m_behaves_like_zeroth_frame);
+  if (lang_runtime_plan_sp.get()) {
+UnwindLogMsg("This is an async frame");
+  }
+
   // Initialize m_current_pc, an Address object, based on current_pc, an
   // addr_t.
   m_current_pc.SetLoadAddress(current_pc, &process->GetTarget());
@@ -203,6 +210,38 @@
 
   UnwindPlan::RowSP active_row;
   lldb::RegisterKind row_register_kind = eRegisterKindGeneric;
+
+  // If we have LanguageRuntime UnwindPlan for this unwind, use those
+  // rules to find the caller frame instead of the function's normal
+  // UnwindPlans.  The full unwind plan for this frame will be
+  // the LanguageRun

[Lldb-commits] [PATCH] D97644: Allow RegisterContext to track if behaves-like-frame-0, allow LanguageRuntime for above frame 0

2021-02-28 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda added a comment.

Another alternative to RegisterContext::BehavesLikeZerothFrame that I've 
thought of is RegisterContext::GetPCForSymbolication, similar to GetPC() today. 
 I think everyone who is decrementing $pc is doing it for symbolication, so 
having this hint and then leaving it to everyone to decrement-or-not may not be 
a great choice.  It may be easier for higher-levels if RegisterContext can 
provide an Address suitable for symbolication directly.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97644/new/

https://reviews.llvm.org/D97644

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits