alexander-shaposhnikov created this revision. alexander-shaposhnikov added reviewers: gribozavr2, njames93, aaron.ballman. alexander-shaposhnikov created this object with visibility "All Users". Herald added subscribers: carlosgalvezp, xazax.hun. Herald added a project: All. alexander-shaposhnikov requested review of this revision. Herald added a project: clang-tools-extra. Herald added a subscriber: cfe-commits.
Restrict use-equals-default to c++11-or-later. Test plan: ninja check-all Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D132998 Files: clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.h clang-tools-extra/docs/ReleaseNotes.rst clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default-cxx98.cpp Index: clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default-cxx98.cpp =================================================================== --- /dev/null +++ clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default-cxx98.cpp @@ -0,0 +1,8 @@ +// RUN: %check_clang_tidy -std=c++98 %s modernize-use-equals-default %t + +struct S { + S() {} + // CHECK-FIXES: S() {} + ~S() {} + // CHECK-FIXES: ~S() {} +}; Index: clang-tools-extra/docs/ReleaseNotes.rst =================================================================== --- clang-tools-extra/docs/ReleaseNotes.rst +++ clang-tools-extra/docs/ReleaseNotes.rst @@ -139,7 +139,7 @@ - Improved `modernize-use-equals-default <clang-tidy/checks/modernize/use-equals-default.html>`_ check. The check now skips unions since in this case a default constructor with empty body - is not equivalent to the explicitly defaulted one. + is not equivalent to the explicitly defaulted one. The check is restricted to c++11-or-later. Removed checks ^^^^^^^^^^^^^^ Index: clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.h =================================================================== --- clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.h +++ clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.h @@ -38,7 +38,7 @@ public: UseEqualsDefaultCheck(StringRef Name, ClangTidyContext *Context); bool isLanguageVersionSupported(const LangOptions &LangOpts) const override { - return LangOpts.CPlusPlus; + return LangOpts.CPlusPlus11; } void storeOptions(ClangTidyOptions::OptionMap &Opts) override; void registerMatchers(ast_matchers::MatchFinder *Finder) override;
Index: clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default-cxx98.cpp =================================================================== --- /dev/null +++ clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default-cxx98.cpp @@ -0,0 +1,8 @@ +// RUN: %check_clang_tidy -std=c++98 %s modernize-use-equals-default %t + +struct S { + S() {} + // CHECK-FIXES: S() {} + ~S() {} + // CHECK-FIXES: ~S() {} +}; Index: clang-tools-extra/docs/ReleaseNotes.rst =================================================================== --- clang-tools-extra/docs/ReleaseNotes.rst +++ clang-tools-extra/docs/ReleaseNotes.rst @@ -139,7 +139,7 @@ - Improved `modernize-use-equals-default <clang-tidy/checks/modernize/use-equals-default.html>`_ check. The check now skips unions since in this case a default constructor with empty body - is not equivalent to the explicitly defaulted one. + is not equivalent to the explicitly defaulted one. The check is restricted to c++11-or-later. Removed checks ^^^^^^^^^^^^^^ Index: clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.h =================================================================== --- clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.h +++ clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.h @@ -38,7 +38,7 @@ public: UseEqualsDefaultCheck(StringRef Name, ClangTidyContext *Context); bool isLanguageVersionSupported(const LangOptions &LangOpts) const override { - return LangOpts.CPlusPlus; + return LangOpts.CPlusPlus11; } void storeOptions(ClangTidyOptions::OptionMap &Opts) override; void registerMatchers(ast_matchers::MatchFinder *Finder) override;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits