Restrict use-equals-default to c++11-or-later.
Test plan: ninja check-all
Differential revision: https://reviews.llvm.org/D132998
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;
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
^^^^^^^^^^^^^^
--- /dev/null
+// RUN: %check_clang_tidy -std=c++98 %s modernize-use-equals-default %t
+
+struct S {
+ S() {}
+ // CHECK-FIXES: S() {}
+ ~S() {}
+ // CHECK-FIXES: ~S() {}
+};