[all-commits] [llvm/llvm-project] 54f57d: [clang] Add a fixit for warn-self-assign if LHS is...

Nathan James via All-commits all-commits at lists.llvm.org
Sat Jul 9 00:28:24 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 54f57d3847c00d0233e287ebb5283d04e6083062
      https://github.com/llvm/llvm-project/commit/54f57d3847c00d0233e287ebb5283d04e6083062
  Author: Nathan James <n.james93 at hotmail.co.uk>
  Date:   2022-07-09 (Sat, 09 Jul 2022)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/include/clang/Sema/Sema.h
    M clang/lib/Sema/SemaChecking.cpp
    M clang/lib/Sema/SemaExpr.cpp
    M clang/test/SemaCXX/warn-self-assign-builtin.cpp
    M clang/test/SemaCXX/warn-self-assign-field-builtin.cpp
    M clang/test/SemaCXX/warn-self-move.cpp

  Log Message:
  -----------
  [clang] Add a fixit for warn-self-assign if LHS is a field with the same name as parameter on RHS

Add a fix-it for the common case of setters/constructors using parameters with the same name as fields
```lang=c++
struct A{
  int X;
  A(int X) { /*this->*/X = X; }
  void setX(int X) { /*this->*/X = X;
};
```

Reviewed By: aaron.ballman

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




More information about the All-commits mailing list