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