clang  15.0.0git
ChromiumCheckModel.h
Go to the documentation of this file.
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/AST/Stmt.h"
19 #include "llvm/ADT/DenseSet.h"
20 
21 namespace clang {
22 namespace dataflow {
23 
24 /// Models the behavior of Chromium's CHECK, DCHECK, etc. macros, so that code
25 /// after a call to `*CHECK` can rely on the condition being true.
27 public:
28  ChromiumCheckModel() = default;
29  bool transfer(const Stmt *Stmt, Environment &Env) override;
30 
31 private:
32  /// Declarations for `::logging::CheckError::.*Check`, lazily initialized.
33  llvm::SmallDenseSet<const CXXMethodDecl *> CheckDecls;
34 };
35 
36 } // namespace dataflow
37 } // namespace clang
38 
39 #endif // CLANG_ANALYSIS_FLOWSENSITIVE_MODELS_CHROMIUMCHECKMODEL_H
clang::dataflow::DataflowModel
Abstract base class for dataflow "models": reusable analysis components that model a particular aspec...
Definition: DataflowAnalysis.h:162
DeclCXX.h
clang::dataflow::ChromiumCheckModel::ChromiumCheckModel
ChromiumCheckModel()=default
DataflowEnvironment.h
clang
Definition: CalledOnceCheck.h:17
clang::Stmt
Stmt - This represents one statement.
Definition: Stmt.h:70
Stmt.h
clang::dataflow::ChromiumCheckModel::transfer
bool transfer(const Stmt *Stmt, Environment &Env) override
Return value indicates whether the model processed the Stmt.
Definition: ChromiumCheckModel.cpp:53
clang::dataflow::Environment
Holds the state of the program (store and heap) at a given program point.
Definition: DataflowEnvironment.h:57
clang::dataflow::ChromiumCheckModel
Models the behavior of Chromium's CHECK, DCHECK, etc.
Definition: ChromiumCheckModel.h:26
DataflowAnalysis.h