This revision was automatically updated to reflect the committed changes. Closed by commit rG9bb5685b2161: [clang-tidy] misc-unconventional-assign-operator suggest to use rvalue… (authored by tetsuo-cpp, committed by njames93).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75901/new/ https://reviews.llvm.org/D75901 Files: clang-tools-extra/clang-tidy/misc/UnconventionalAssignOperatorCheck.cpp clang-tools-extra/test/clang-tidy/checkers/misc-unconventional-assign-operator-precxx11.cpp Index: clang-tools-extra/test/clang-tidy/checkers/misc-unconventional-assign-operator-precxx11.cpp =================================================================== --- /dev/null +++ clang-tools-extra/test/clang-tidy/checkers/misc-unconventional-assign-operator-precxx11.cpp @@ -0,0 +1,6 @@ +// RUN: %check_clang_tidy -std=c++98,c++03 %s misc-unconventional-assign-operator %t + +struct BadArgument { + BadArgument &operator=(BadArgument &); + // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: operator=() should take 'BadArgument const&' or 'BadArgument' +}; Index: clang-tools-extra/clang-tidy/misc/UnconventionalAssignOperatorCheck.cpp =================================================================== --- clang-tools-extra/clang-tidy/misc/UnconventionalAssignOperatorCheck.cpp +++ clang-tools-extra/clang-tidy/misc/UnconventionalAssignOperatorCheck.cpp @@ -75,7 +75,10 @@ } else { static const char *const Messages[][2] = { {"ReturnType", "operator=() should return '%0&'"}, - {"ArgumentType", "operator=() should take '%0 const&', '%0&&' or '%0'"}, + {"ArgumentType", + getLangOpts().CPlusPlus11 + ? "operator=() should take '%0 const&', '%0&&' or '%0'" + : "operator=() should take '%0 const&' or '%0'"}, {"cv", "operator=() should not be marked '%1'"}}; const auto *Method = Result.Nodes.getNodeAs<CXXMethodDecl>("method");
Index: clang-tools-extra/test/clang-tidy/checkers/misc-unconventional-assign-operator-precxx11.cpp =================================================================== --- /dev/null +++ clang-tools-extra/test/clang-tidy/checkers/misc-unconventional-assign-operator-precxx11.cpp @@ -0,0 +1,6 @@ +// RUN: %check_clang_tidy -std=c++98,c++03 %s misc-unconventional-assign-operator %t + +struct BadArgument { + BadArgument &operator=(BadArgument &); + // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: operator=() should take 'BadArgument const&' or 'BadArgument' +}; Index: clang-tools-extra/clang-tidy/misc/UnconventionalAssignOperatorCheck.cpp =================================================================== --- clang-tools-extra/clang-tidy/misc/UnconventionalAssignOperatorCheck.cpp +++ clang-tools-extra/clang-tidy/misc/UnconventionalAssignOperatorCheck.cpp @@ -75,7 +75,10 @@ } else { static const char *const Messages[][2] = { {"ReturnType", "operator=() should return '%0&'"}, - {"ArgumentType", "operator=() should take '%0 const&', '%0&&' or '%0'"}, + {"ArgumentType", + getLangOpts().CPlusPlus11 + ? "operator=() should take '%0 const&', '%0&&' or '%0'" + : "operator=() should take '%0 const&' or '%0'"}, {"cv", "operator=() should not be marked '%1'"}}; const auto *Method = Result.Nodes.getNodeAs<CXXMethodDecl>("method");
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits