1//===-- ChromiumCheckModel.h ------------------------------------*- 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 a dataflow model for Chromium's family of CHECK functions.
10//
11//===----------------------------------------------------------------------===//
12#ifndef CLANG_ANALYSIS_FLOWSENSITIVE_MODELS_CHROMIUMCHECKMODEL_H
13#define CLANG_ANALYSIS_FLOWSENSITIVE_MODELS_CHROMIUMCHECKMODEL_H
14
15#include "clang/AST/DeclCXX.h"
16#include "clang/Analysis/FlowSensitive/DataflowAnalysis.h"
17#include "clang/Analysis/FlowSensitive/DataflowEnvironment.h"
18#include "llvm/ADT/DenseSet.h"
19
20namespace clang {
21namespace dataflow {
22
23/// Models the behavior of Chromium's CHECK, DCHECK, etc. macros, so that code
24/// after a call to `*CHECK` can rely on the condition being true.
25class ChromiumCheckModel : public DataflowModel {
26public:
27 ChromiumCheckModel() = default;
28 bool transfer(const CFGElement &Element, Environment &Env) override;
29
30private:
31 /// Declarations for `::logging::CheckError::.*Check`, lazily initialized.
32 llvm::SmallDenseSet<const CXXMethodDecl *> CheckDecls;
33};
34
35} // namespace dataflow
36} // namespace clang
37
38#endif // CLANG_ANALYSIS_FLOWSENSITIVE_MODELS_CHROMIUMCHECKMODEL_H
39

source code of clang/include/clang/Analysis/FlowSensitive/Models/ChromiumCheckModel.h