Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:19

0001 //===--- UnusedLocalNonTrivialVariableCheck.h - clang-tidy ------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_UNUSEDLOCALNONTRIVIALVARIABLECHECK_H
0010 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_UNUSEDLOCALNONTRIVIALVARIABLECHECK_H
0011 
0012 #include "../ClangTidyCheck.h"
0013 
0014 namespace clang::tidy::bugprone {
0015 
0016 /// Warns when a local non trivial variable is unused within a function. By
0017 /// default std::.*mutex and std::future are included.
0018 ///
0019 /// The check supports these options:
0020 ///   - 'IncludeTypes': a semicolon-separated list of regular expressions
0021 ///                     matching types to ensure must be used.
0022 ///   - 'ExcludeTypes': a semicolon-separated list of regular expressions
0023 ///                     matching types that are excluded from the
0024 ///                     'IncludeTypes' matches.
0025 ///
0026 /// For the user-facing documentation see:
0027 /// http://clang.llvm.org/extra/clang-tidy/checks/bugprone/unused-local-non-trivial-variable.html
0028 class UnusedLocalNonTrivialVariableCheck : public ClangTidyCheck {
0029 public:
0030   UnusedLocalNonTrivialVariableCheck(StringRef Name, ClangTidyContext *Context);
0031   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
0032   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
0033   void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
0034   bool isLanguageVersionSupported(const LangOptions &LangOpts) const override;
0035   std::optional<TraversalKind> getCheckTraversalKind() const override;
0036 
0037 private:
0038   const std::vector<StringRef> IncludeTypes;
0039   const std::vector<StringRef> ExcludeTypes;
0040 };
0041 
0042 } // namespace clang::tidy::bugprone
0043 
0044 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_UNUSEDLOCALNONTRIVIALVARIABLECHECK_H