TemporaryObjectsCheck.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. //===--- TemporaryObjectsCheck.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_ZIRCON_TEMPORARYOBJECTSCHECK_H
  9. #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ZIRCON_TEMPORARYOBJECTSCHECK_H
  10. #include "../ClangTidyCheck.h"
  11. #include "../utils/OptionsUtils.h"
  12. namespace clang::tidy::zircon {
  13. /// Construction of specific temporary objects in the Zircon kernel is
  14. /// discouraged.
  15. ///
  16. /// For the user-facing documentation see:
  17. /// http://clang.llvm.org/extra/clang-tidy/checks/zircon/temporary-objects.html
  18. class TemporaryObjectsCheck : public ClangTidyCheck {
  19. public:
  20. TemporaryObjectsCheck(StringRef Name, ClangTidyContext *Context)
  21. : ClangTidyCheck(Name, Context),
  22. Names(utils::options::parseStringList(Options.get("Names", ""))) {}
  23. void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
  24. void registerMatchers(ast_matchers::MatchFinder *Finder) override;
  25. void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
  26. private:
  27. std::vector<StringRef> Names;
  28. };
  29. } // namespace clang::tidy::zircon
  30. #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ZIRCON_TEMPORARYOBJECTSCHECK_H