================
@@ -541,75 +557,91 @@ std::optional<StringRef> getterVariableName(const
CXXMethodDecl *CMD) {
// void foo(T arg) { FieldName = std::move(arg); }
// R foo(T arg) { FieldName = std::move(arg); return *this; }
// then returns "FieldName"
-std::optional<StringRef> setterVariableName(const CXXMethodDecl *CMD) {
+// Returns the LHS expression of the assignment in a trivial setter body, or
+// nullptr if the method does not match the pattern of a trivial setter.
----------------
timon-ul wrote:
Actually I got baited a bit by the old comment too, it mentions the case of
`return *this`, which is only a trivial setter if the return type is
specifically a reference, so it should probably say `R&` and not just `R`.
Also `return this` is also working and missing from the list (this then
actually has a return type of `R`).
https://github.com/llvm/llvm-project/pull/182738
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits