[PATCH] D158134: Guard against self-assignment in InputArgList

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 17 11:05:30 PDT 2023


dblaikie added a comment.

Any chance of adding unit test coverage for this?



================
Comment at: llvm/include/llvm/Option/ArgList.h:422-429
+    if (this != &RHS) {
+      releaseMemory();
+      ArgList::operator=(std::move(RHS));
+      ArgStrings = std::move(RHS.ArgStrings);
+      SynthesizedStrings = std::move(RHS.SynthesizedStrings);
+      NumInputArgStrings = RHS.NumInputArgStrings;
+    }
----------------
I'd probably reduce indentation with an early return, even if it means duplicating the (fairly simple) return expression. But no big deal either way.


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

https://reviews.llvm.org/D158134



More information about the llvm-commits mailing list