|
|
|||
File indexing completed on 2026-05-10 08:36:25
0001 //===-- Transfer.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 transfer function that evaluates a program statement and 0010 // updates an environment accordingly. 0011 // 0012 //===----------------------------------------------------------------------===// 0013 0014 #ifndef LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_TRANSFER_H 0015 #define LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_TRANSFER_H 0016 0017 #include "clang/AST/Stmt.h" 0018 #include "clang/Analysis/FlowSensitive/DataflowAnalysisContext.h" 0019 #include "clang/Analysis/FlowSensitive/DataflowEnvironment.h" 0020 #include "clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h" 0021 0022 namespace clang { 0023 namespace dataflow { 0024 0025 /// Maps statements to the environments of basic blocks that contain them. 0026 class StmtToEnvMap { 0027 public: 0028 // `CurBlockID` is the ID of the block currently being processed, and 0029 // `CurState` is the pending state currently associated with this block. These 0030 // are supplied separately as the pending state for the current block may not 0031 // yet be represented in `BlockToState`. 0032 StmtToEnvMap(const AdornedCFG &ACFG, 0033 llvm::ArrayRef<std::optional<TypeErasedDataflowAnalysisState>> 0034 BlockToState, 0035 unsigned CurBlockID, 0036 const TypeErasedDataflowAnalysisState &CurState) 0037 : ACFG(ACFG), BlockToState(BlockToState), CurBlockID(CurBlockID), 0038 CurState(CurState) {} 0039 0040 /// Returns the environment of the basic block that contains `S`. 0041 /// The result is guaranteed never to be null. 0042 const Environment *getEnvironment(const Stmt &S) const; 0043 0044 private: 0045 const AdornedCFG &ACFG; 0046 llvm::ArrayRef<std::optional<TypeErasedDataflowAnalysisState>> BlockToState; 0047 unsigned CurBlockID; 0048 const TypeErasedDataflowAnalysisState &CurState; 0049 }; 0050 0051 /// Evaluates `S` and updates `Env` accordingly. 0052 /// 0053 /// Requirements: 0054 /// 0055 /// `S` must not be `ParenExpr` or `ExprWithCleanups`. 0056 void transfer(const StmtToEnvMap &StmtToEnv, const Stmt &S, Environment &Env, 0057 Environment::ValueModel &Model); 0058 0059 } // namespace dataflow 0060 } // namespace clang 0061 0062 #endif // LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_TRANSFER_H
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|