Rename -Wself-assign-memvar to -Wself-assign-field to improve local consistency a bit.

(cf -Wunused-private-field and several other existing -field diagnostics.)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159633 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td
index ab2cd1b..8753589 100644
--- a/include/clang/Basic/DiagnosticGroups.td
+++ b/include/clang/Basic/DiagnosticGroups.td
@@ -169,8 +169,8 @@
 def ReturnType : DiagGroup<"return-type", [ReturnTypeCLinkage]>;
 def BindToTemporaryCopy : DiagGroup<"bind-to-temporary-copy",
                                     [CXX98CompatBindToTemporaryCopy]>;
-def SelfAssignmentMemvar : DiagGroup<"self-assign-memvar">;
-def SelfAssignment : DiagGroup<"self-assign", [SelfAssignmentMemvar]>;
+def SelfAssignmentField : DiagGroup<"self-assign-field">;
+def SelfAssignment : DiagGroup<"self-assign", [SelfAssignmentField]>;
 def SemiBeforeMethodBody : DiagGroup<"semicolon-before-method-body">;
 def Sentinel : DiagGroup<"sentinel">;
 def MissingMethodReturnType : DiagGroup<"missing-method-return-type">;
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td
index 66ae44f..d691169 100644
--- a/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/include/clang/Basic/DiagnosticSemaKinds.td
@@ -5283,9 +5283,9 @@
   "unspecified (use strncmp instead)">,
   InGroup<DiagGroup<"string-compare">>;
 
-def warn_identity_memvar_assign : Warning<
-  "assigning %select{member variable|instance variable}0 to itself">,
-  InGroup<SelfAssignmentMemvar>;
+def warn_identity_field_assign : Warning<
+  "assigning %select{field|instance variable}0 to itself">,
+  InGroup<SelfAssignmentField>;
 
 // Generic selections.
 def err_assoc_type_incomplete : Error<
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 1f2850f..cfc55e5 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -7558,25 +7558,25 @@
   return true;
 }
 
-static void CheckIdentityMemvarAssignment(Expr *LHSExpr, Expr *RHSExpr,
-                                          SourceLocation Loc,
-                                          Sema &Sema) {
-  // C / C++ memvars
+static void CheckIdentityFieldAssignment(Expr *LHSExpr, Expr *RHSExpr,
+                                         SourceLocation Loc,
+                                         Sema &Sema) {
+  // C / C++ fields
   MemberExpr *ML = dyn_cast<MemberExpr>(LHSExpr);
   MemberExpr *MR = dyn_cast<MemberExpr>(RHSExpr);
   if (ML && MR && ML->getMemberDecl() == MR->getMemberDecl()) {
     if (isa<CXXThisExpr>(ML->getBase()) && isa<CXXThisExpr>(MR->getBase()))
-      Sema.Diag(Loc, diag::warn_identity_memvar_assign) << 0;
+      Sema.Diag(Loc, diag::warn_identity_field_assign) << 0;
   }
 
-  // Objective-C memvars
+  // Objective-C instance variables
   ObjCIvarRefExpr *OL = dyn_cast<ObjCIvarRefExpr>(LHSExpr);
   ObjCIvarRefExpr *OR = dyn_cast<ObjCIvarRefExpr>(RHSExpr);
   if (OL && OR && OL->getDecl() == OR->getDecl()) {
     DeclRefExpr *RL = dyn_cast<DeclRefExpr>(OL->getBase()->IgnoreImpCasts());
     DeclRefExpr *RR = dyn_cast<DeclRefExpr>(OR->getBase()->IgnoreImpCasts());
     if (RL && RR && RL->getDecl() == RR->getDecl())
-      Sema.Diag(Loc, diag::warn_identity_memvar_assign) << 1;
+      Sema.Diag(Loc, diag::warn_identity_field_assign) << 1;
   }
 }
 
@@ -7597,7 +7597,7 @@
   if (CompoundType.isNull()) {
     Expr *RHSCheck = RHS.get();
 
-    CheckIdentityMemvarAssignment(LHSExpr, RHSCheck, Loc, *this);
+    CheckIdentityFieldAssignment(LHSExpr, RHSCheck, Loc, *this);
 
     QualType LHSTy(LHSType);
     ConvTy = CheckSingleAssignmentConstraints(LHSTy, RHS);
diff --git a/test/Sema/warn-self-assign-memvar.mm b/test/Sema/warn-self-assign-field.mm
similarity index 86%
rename from test/Sema/warn-self-assign-memvar.mm
rename to test/Sema/warn-self-assign-field.mm
index 8c6fb0a..ad0ff3e 100644
--- a/test/Sema/warn-self-assign-memvar.mm
+++ b/test/Sema/warn-self-assign-field.mm
@@ -4,10 +4,10 @@
  public:
   int a_;
   void s(int a) {
-    a_ = a_;  // expected-warning {{assigning member variable to itself}}
+    a_ = a_;  // expected-warning {{assigning field to itself}}
 
     // Don't really care about this one either way.
-    this->a_ = a_;  // expected-warning {{assigning member variable to itself}}
+    this->a_ = a_;  // expected-warning {{assigning field to itself}}
 
     a_ += a_;  // Shouldn't warn.
   }