Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:24

0001 //===-- ChromiumCheckModel.h ------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This file defines a dataflow model for Chromium's family of CHECK functions.
0010 //
0011 //===----------------------------------------------------------------------===//
0012 #ifndef CLANG_ANALYSIS_FLOWSENSITIVE_MODELS_CHROMIUMCHECKMODEL_H
0013 #define CLANG_ANALYSIS_FLOWSENSITIVE_MODELS_CHROMIUMCHECKMODEL_H
0014 
0015 #include "clang/AST/DeclCXX.h"
0016 #include "clang/Analysis/FlowSensitive/DataflowAnalysis.h"
0017 #include "clang/Analysis/FlowSensitive/DataflowEnvironment.h"
0018 #include "llvm/ADT/DenseSet.h"
0019 
0020 namespace clang {
0021 namespace dataflow {
0022 
0023 /// Models the behavior of Chromium's CHECK, DCHECK, etc. macros, so that code
0024 /// after a call to `*CHECK` can rely on the condition being true.
0025 class ChromiumCheckModel : public DataflowModel {
0026 public:
0027   ChromiumCheckModel() = default;
0028   bool transfer(const CFGElement &Element, Environment &Env) override;
0029 
0030 private:
0031   /// Declarations for `::logging::CheckError::.*Check`, lazily initialized.
0032   llvm::SmallDenseSet<const CXXMethodDecl *> CheckDecls;
0033 };
0034 
0035 } // namespace dataflow
0036 } // namespace clang
0037 
0038 #endif // CLANG_ANALYSIS_FLOWSENSITIVE_MODELS_CHROMIUMCHECKMODEL_H