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

Tatyana Krasnukha via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 17 03:34:26 PST 2021


tatyana-krasnukha added a comment.

CRTP was my first implementation, however, I discarded it as more bug-prone. Virtual Clone function at the interface is so common that, I believe, everyone knows it must be overridden by a new derived class. The necessity of inheriting from base_clone_helper is not so obvious.



================
Comment at: lldb/unittests/Interpreter/TestOptionValue.cpp:173
+  // Trigger the callback second time.
+  file_list_copy_ptr->SetValueFromString(llvm::StringRef("0 another/path"),
+                                         eVarSetOperationReplace);
----------------
dblaikie wrote:
> Generally it shouldn't be necessary to write `llvm::StringRef(...)` around a string literal - StringRef is implicitly convertible from a string literal.
OptionValueProperties and OptionValueFileSpecList enforce using StringRef explicitly by specifying the overload SetValueFromString(const char*) as deleted.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96817



More information about the lldb-commits mailing list