blob: cc16c421a11653fc01e30bcab6eeaa2cb6553021 [file] [log] [blame]
//===--- FblMemoryCheck.h - clang-tidy ------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ZIRCON_FBLMEMORYCHECK_H
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ZIRCON_FBLMEMORYCHECK_H
#include "../ClangTidy.h"
#include "../utils/IncludeInserter.h"
namespace clang {
namespace tidy {
namespace zircon {
/// Replace instances of fbl::numeric_limits with std::numeric_limits, removes
/// <fbl/limits.h> includes and adds <limits> include if std::numeric_limits is
/// used.
///
/// For the user-facing documentation see:
/// http://clang.llvm.org/extra/clang-tidy/checks/zircon-fbl-limits.html
class FblMemoryCheck : public ClangTidyCheck {
public:
FblMemoryCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
IncludeStyle(utils::IncludeSorter::parseIncludeStyle(
Options.getLocalOrGlobal("IncludeStyle", "google"))) {}
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void registerPPCallbacks(clang::CompilerInstance &Compiler) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
private:
std::unique_ptr<utils::IncludeInserter> Inserter;
const utils::IncludeSorter::IncludeStyle IncludeStyle;
};
} // namespace zircon
} // namespace tidy
} // namespace clang
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ZIRCON_FBLMEMORYCHECK_H