RedundantStringInitCheck.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. //===- RedundantStringInitCheck.h - clang-tidy ------------------*- C++ -*-===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_REDUNDANT_STRING_INIT_H
  9. #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_REDUNDANT_STRING_INIT_H
  10. #include "../ClangTidyCheck.h"
  11. #include <string>
  12. #include <vector>
  13. namespace clang::tidy::readability {
  14. /// Finds unnecessary string initializations.
  15. class RedundantStringInitCheck : public ClangTidyCheck {
  16. public:
  17. RedundantStringInitCheck(StringRef Name, ClangTidyContext *Context);
  18. bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
  19. return LangOpts.CPlusPlus;
  20. }
  21. void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
  22. void registerMatchers(ast_matchers::MatchFinder *Finder) override;
  23. void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
  24. private:
  25. std::vector<StringRef> StringNames;
  26. };
  27. } // namespace clang::tidy::readability
  28. #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_REDUNDANT_STRING_INIT_H