[clang-tools-extra] [clang-tidy]unused using decls only check cpp files (PR #77335)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 8 08:27:09 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-tidy
Author: Congcong Cai (HerrCai0907)
<details>
<summary>Changes</summary>
using decls can be used in cpp
---
Full diff: https://github.com/llvm/llvm-project/pull/77335.diff
2 Files Affected:
- (modified) clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.h (+4-1)
- (modified) clang-tools-extra/docs/ReleaseNotes.rst (+1-1)
``````````diff
diff --git a/clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.h b/clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.h
index fa2a8799d098c3..aab9a57b8ba01d 100644
--- a/clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.h
+++ b/clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.h
@@ -26,7 +26,10 @@ 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
``````````
</details>
https://github.com/llvm/llvm-project/pull/77335
More information about the cfe-commits
mailing list