[clang-tools-extra] bfd99be - [clang-tidy] Update lang restrictions on perf module
Nathan James via cfe-commits
cfe-commits at lists.llvm.org
Sun Jun 28 07:18:23 PDT 2020
Author: Nathan James
Date: 2020-06-28T15:18:08+01:00
New Revision: bfd99be0fc58fe644aff76d180b333e6d840126a
URL: https://github.com/llvm/llvm-project/commit/bfd99be0fc58fe644aff76d180b333e6d840126a
DIFF: https://github.com/llvm/llvm-project/commit/bfd99be0fc58fe644aff76d180b333e6d840126a.diff
LOG: [clang-tidy] Update lang restrictions on perf module
Added:
Modified:
clang-tools-extra/clang-tidy/performance/FasterStringFindCheck.cpp
clang-tools-extra/clang-tidy/performance/FasterStringFindCheck.h
clang-tools-extra/clang-tidy/performance/ForRangeCopyCheck.h
clang-tools-extra/clang-tidy/performance/ImplicitConversionInLoopCheck.h
clang-tools-extra/clang-tidy/performance/InefficientVectorOperationCheck.h
clang-tools-extra/clang-tidy/performance/UnnecessaryCopyInitialization.h
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-tidy/performance/FasterStringFindCheck.cpp b/clang-tools-extra/clang-tidy/performance/FasterStringFindCheck.cpp
index bb0a02f06fc6..a6216b230911 100644
--- a/clang-tools-extra/clang-tidy/performance/FasterStringFindCheck.cpp
+++ b/clang-tools-extra/clang-tidy/performance/FasterStringFindCheck.cpp
@@ -59,9 +59,6 @@ void FasterStringFindCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
}
void FasterStringFindCheck::registerMatchers(MatchFinder *Finder) {
- if (!getLangOpts().CPlusPlus)
- return;
-
const auto SingleChar =
expr(ignoringParenCasts(stringLiteral(hasSize(1)).bind("literal")));
const auto StringFindFunctions =
diff --git a/clang-tools-extra/clang-tidy/performance/FasterStringFindCheck.h b/clang-tools-extra/clang-tidy/performance/FasterStringFindCheck.h
index 7d46d06c375c..71a45705f1e8 100644
--- a/clang-tools-extra/clang-tidy/performance/FasterStringFindCheck.h
+++ b/clang-tools-extra/clang-tidy/performance/FasterStringFindCheck.h
@@ -27,6 +27,9 @@ namespace performance {
class FasterStringFindCheck : public ClangTidyCheck {
public:
FasterStringFindCheck(StringRef Name, ClangTidyContext *Context);
+ bool isLanguageVersionSupported(const LangOptions &LangOpts) const override{
+ return LangOpts.CPlusPlus;
+ }
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
diff --git a/clang-tools-extra/clang-tidy/performance/ForRangeCopyCheck.h b/clang-tools-extra/clang-tidy/performance/ForRangeCopyCheck.h
index 3745c7bb4681..71f662ba5544 100644
--- a/clang-tools-extra/clang-tidy/performance/ForRangeCopyCheck.h
+++ b/clang-tools-extra/clang-tidy/performance/ForRangeCopyCheck.h
@@ -22,6 +22,9 @@ namespace performance {
class ForRangeCopyCheck : public ClangTidyCheck {
public:
ForRangeCopyCheck(StringRef Name, ClangTidyContext *Context);
+ bool isLanguageVersionSupported(const LangOptions &LangOpts) const override{
+ return LangOpts.CPlusPlus11;
+ }
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
diff --git a/clang-tools-extra/clang-tidy/performance/ImplicitConversionInLoopCheck.h b/clang-tools-extra/clang-tidy/performance/ImplicitConversionInLoopCheck.h
index b372003a8002..4b271366f0f6 100644
--- a/clang-tools-extra/clang-tidy/performance/ImplicitConversionInLoopCheck.h
+++ b/clang-tools-extra/clang-tidy/performance/ImplicitConversionInLoopCheck.h
@@ -22,6 +22,9 @@ class ImplicitConversionInLoopCheck : public ClangTidyCheck {
public:
ImplicitConversionInLoopCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context) {}
+ bool isLanguageVersionSupported(const LangOptions &LangOpts) const override{
+ return LangOpts.CPlusPlus11;
+ }
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
diff --git a/clang-tools-extra/clang-tidy/performance/InefficientVectorOperationCheck.h b/clang-tools-extra/clang-tidy/performance/InefficientVectorOperationCheck.h
index e224dcc90685..533b30dc32b0 100644
--- a/clang-tools-extra/clang-tidy/performance/InefficientVectorOperationCheck.h
+++ b/clang-tools-extra/clang-tidy/performance/InefficientVectorOperationCheck.h
@@ -26,6 +26,9 @@ namespace performance {
class InefficientVectorOperationCheck : public ClangTidyCheck {
public:
InefficientVectorOperationCheck(StringRef Name, ClangTidyContext *Context);
+ bool isLanguageVersionSupported(const LangOptions &LangOpts) const override{
+ return LangOpts.CPlusPlus;
+ }
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
diff --git a/clang-tools-extra/clang-tidy/performance/UnnecessaryCopyInitialization.h b/clang-tools-extra/clang-tidy/performance/UnnecessaryCopyInitialization.h
index 0a530e373296..eeb9138d8532 100644
--- a/clang-tools-extra/clang-tidy/performance/UnnecessaryCopyInitialization.h
+++ b/clang-tools-extra/clang-tidy/performance/UnnecessaryCopyInitialization.h
@@ -26,6 +26,9 @@ namespace performance {
class UnnecessaryCopyInitialization : public ClangTidyCheck {
public:
UnnecessaryCopyInitialization(StringRef Name, ClangTidyContext *Context);
+ bool isLanguageVersionSupported(const LangOptions &LangOpts) const override{
+ return LangOpts.CPlusPlus;
+ }
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
More information about the cfe-commits
mailing list