Subversion Repositories QNX 8.QNX8 LLVM/Clang compiler suite

Rev

Blame | Last modification | View Log | Download | RSS feed

  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"
  17. #include "clang/Analysis/FlowSensitive/DataflowAnalysis.h"
  18. #include "clang/Analysis/FlowSensitive/DataflowEnvironment.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.
  26. class ChromiumCheckModel : public DataflowModel {
  27. public:
  28.   ChromiumCheckModel() = default;
  29.   bool transfer(const CFGElement *Element, 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
  40.