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 
14 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
15 #include "clang/StaticAnalyzer/Core/Checker.h"
16 
17 using namespace clang;
18 using namespace ento;
19 
getTagDescription() const20 StringRef CheckerBase::getTagDescription() const {
21   return getCheckName().getName();
22 }
23 
getCheckName() const24 CheckName CheckerBase::getCheckName() const { return Name; }
25 
CheckerProgramPointTag(StringRef CheckerName,StringRef Msg)26 CheckerProgramPointTag::CheckerProgramPointTag(StringRef CheckerName,
27                                                StringRef Msg)
28   : SimpleProgramPointTag(CheckerName, Msg) {}
29 
CheckerProgramPointTag(const CheckerBase * Checker,StringRef Msg)30 CheckerProgramPointTag::CheckerProgramPointTag(const CheckerBase *Checker,
31                                                StringRef Msg)
32   : SimpleProgramPointTag(Checker->getCheckName().getName(), Msg) {}
33 
operator <<(raw_ostream & Out,const CheckerBase & Checker)34 raw_ostream& clang::ento::operator<<(raw_ostream &Out,
35                                      const CheckerBase &Checker) {
36   Out << Checker.getCheckName().getName();
37   return Out;
38 }
39