Checker.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. //== Checker.cpp - Registration mechanism for checkers -----------*- C++ -*--=//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // This file defines Checker, used to create and register checkers.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
  14. #include "clang/StaticAnalyzer/Core/Checker.h"
  15. using namespace clang;
  16. using namespace ento;
  17. StringRef CheckerBase::getTagDescription() const {
  18. return getCheckName().getName();
  19. }
  20. CheckName CheckerBase::getCheckName() 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->getCheckName().getName(), Msg) {}
  27. raw_ostream& clang::ento::operator<<(raw_ostream &Out,
  28. const CheckerBase &Checker) {
  29. Out << Checker.getCheckName().getName();
  30. return Out;
  31. }