Checker.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //== Checker.cpp - Registration mechanism for checkers -----------*- 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. //
  9. // This file defines Checker, used to create and register checkers.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
  13. #include "clang/StaticAnalyzer/Core/Checker.h"
  14. using namespace clang;
  15. using namespace ento;
  16. int ImplicitNullDerefEvent::Tag;
  17. StringRef CheckerBase::getTagDescription() const {
  18. return getCheckerName().getName();
  19. }
  20. CheckerNameRef CheckerBase::getCheckerName() const { return Name; }
  21. CheckerProgramPointTag::CheckerProgramPointTag(StringRef CheckerName,
  22. StringRef Msg)
  23. : SimpleProgramPointTag(CheckerName, Msg) {}
  24. CheckerProgramPointTag::CheckerProgramPointTag(const CheckerBase *Checker,
  25. StringRef Msg)
  26. : SimpleProgramPointTag(Checker->getCheckerName().getName(), Msg) {}
  27. raw_ostream& clang::ento::operator<<(raw_ostream &Out,
  28. const CheckerBase &Checker) {
  29. Out << Checker.getCheckerName().getName();
  30. return Out;
  31. }