[clang-tools-extra] [clang-tidy]unused using decls only check cpp files (PR #77335)
Congcong Cai via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 8 08:41:49 PST 2024
https://github.com/HerrCai0907 updated https://github.com/llvm/llvm-project/pull/77335
>From 832bb78fd8cac372ec5560bb280f11e11be8d2e6 Mon Sep 17 00:00:00 2001
From: Congcong Cai <congcongcai0907 at 163.com>
Date: Tue, 9 Jan 2024 00:41:33 +0800
Subject: [PATCH] [clang-tidy]unused using decls only check cpp files
---
clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.h | 3 +++
clang-tools-extra/docs/ReleaseNotes.rst | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.h b/clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.h
index fa2a8799d098c3..498b3ffd2678c3 100644
--- a/clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.h
+++ b/clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.h
@@ -26,6 +26,9 @@ class UnusedUsingDeclsCheck : public ClangTidyCheck {
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
void onEndOfTranslationUnit() override;
+ bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
+ return LangOpts.CPlusPlus;
+ }
private:
void removeFromFoundDecls(const Decl *D);
diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst
index 1bd5a72126c10b..d7f46cede0370c 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -382,7 +382,7 @@ Changes in existing checks
- Improved :doc:`misc-unused-using-decls
<clang-tidy/checks/misc/unused-using-decls>` check to avoid false positive when
- using in elaborated type.
+ using in elaborated type and only check cpp files.
- Improved :doc:`modernize-avoid-bind
<clang-tidy/checks/modernize/avoid-bind>` check to
More information about the cfe-commits
mailing list