diff options
| author | Tatyana Krasnukha <tatyana@synopsys.com> | 2021-02-20 00:49:42 +0300 |
|---|---|---|
| committer | Tatyana Krasnukha <tatyana@synopsys.com> | 2021-02-28 19:23:25 +0300 |
| commit | f0f183ee4ad952d94234cf6971c69a044e05c9df (patch) | |
| tree | d36d5b3aa8719a019529ca7fb702d565042ba498 /lldb/source/Interpreter/OptionValueFileSpec.cpp | |
| parent | ef447fe0088cacc38027028d4c43c1938d3eb9e7 (diff) | |
| download | llvm-f0f183ee4ad952d94234cf6971c69a044e05c9df.zip llvm-f0f183ee4ad952d94234cf6971c69a044e05c9df.tar.gz llvm-f0f183ee4ad952d94234cf6971c69a044e05c9df.tar.bz2 | |
[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
Diffstat (limited to 'lldb/source/Interpreter/OptionValueFileSpec.cpp')
| -rw-r--r-- | lldb/source/Interpreter/OptionValueFileSpec.cpp | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/lldb/source/Interpreter/OptionValueFileSpec.cpp b/lldb/source/Interpreter/OptionValueFileSpec.cpp index 8d43371..9f80cc86 100644 --- a/lldb/source/Interpreter/OptionValueFileSpec.cpp +++ b/lldb/source/Interpreter/OptionValueFileSpec.cpp @@ -84,10 +84,6 @@ Status OptionValueFileSpec::SetValueFromString(llvm::StringRef value, return error; } -lldb::OptionValueSP OptionValueFileSpec::DeepCopy() const { - return OptionValueSP(new OptionValueFileSpec(*this)); -} - void OptionValueFileSpec::AutoComplete(CommandInterpreter &interpreter, CompletionRequest &request) { CommandCompletions::InvokeCommonCompletionCallbacks( |
