summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2015-01-10 06:04:18 +0000
committerRichard Trieu <rtrieu@google.com>2015-01-10 06:04:18 +0000
commit53472c9fc35126a8473db35e8ea8daabadf761b4 (patch)
tree499b0b47f53f471ccb07705143dc7ea801b0c6a2 /include
parent22c634704f7f4a0803f08bebd1e1bc662f5ab77f (diff)
Add a new warning, -Wself-move, to Clang.
-Wself-move is similiar to -Wself-assign. This warning is triggered when a value is attempted to be moved to itself. See r221008 for a bug that would have been caught with this warning. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225581 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/clang/Basic/DiagnosticGroups.td2
-rw-r--r--include/clang/Basic/DiagnosticSemaKinds.td3
2 files changed, 5 insertions, 0 deletions
diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td
index d4610e0a3f..75d40b17a6 100644
--- a/include/clang/Basic/DiagnosticGroups.td
+++ b/include/clang/Basic/DiagnosticGroups.td
@@ -294,6 +294,7 @@ def BindToTemporaryCopy : DiagGroup<"bind-to-temporary-copy",
[CXX98CompatBindToTemporaryCopy]>;
def SelfAssignmentField : DiagGroup<"self-assign-field">;
def SelfAssignment : DiagGroup<"self-assign", [SelfAssignmentField]>;
+def SelfMove : DiagGroup<"self-move">;
def SemiBeforeMethodBody : DiagGroup<"semicolon-before-method-body">;
def Sentinel : DiagGroup<"sentinel">;
def MissingMethodReturnType : DiagGroup<"missing-method-return-type">;
@@ -586,6 +587,7 @@ def Most : DiagGroup<"most", [
Reorder,
ReturnType,
SelfAssignment,
+ SelfMove,
SizeofArrayArgument,
SizeofArrayDecay,
StringPlusInt,
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td
index cfe7b99b93..4bf83b6aed 100644
--- a/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/include/clang/Basic/DiagnosticSemaKinds.td
@@ -4701,6 +4701,9 @@ def warn_addition_in_bitshift : Warning<
def warn_self_assignment : Warning<
"explicitly assigning value of variable of type %0 to itself">,
InGroup<SelfAssignment>, DefaultIgnore;
+def warn_self_move : Warning<
+ "explicitly moving variable of type %0 to itself">,
+ InGroup<SelfMove>, DefaultIgnore;
def warn_string_plus_int : Warning<
"adding %0 to a string does not append to the string">,