clang: include/clang/Analysis/FlowSensitive/AdornedCFG.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_ADORNEDCFG_H
15#define LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_ADORNEDCFG_H
16
22#include "llvm/ADT/BitVector.h"
23#include "llvm/ADT/DenseMap.h"
24#include "llvm/Support/Error.h"
25#include
26#include
27
29namespace dataflow {
30
31namespace internal {
33public:
35
38 }
39
40private:
41 llvm::DenseMap<const Stmt *, const CFGBlock *> StmtToBlock;
42};
43}
44
45
46
48public:
49
50
51
53
54
55
58
59
60
61 const Decl &getDecl() const { return ContainingDecl; }
62
63
64 const CFG &getCFG() const { return *Cfg; }
65
66
67
69 return StmtToBlock.lookup(S);
70 }
71
72
74 return BlockReachable[B.getBlockID()];
75 }
76
77
78
79
80
81
82
83
84
86 return ContainsExprConsumedInDifferentBlock.contains(&B);
87 }
88
89private:
91 const Decl &D, std::unique_ptr Cfg,
93 llvm::DenseSet<const CFGBlock *> ContainsExprConsumedInDifferentBlock)
94 : ContainingDecl(D), Cfg(std::move(Cfg)),
95 StmtToBlock(std::move(StmtToBlock)),
96 BlockReachable(std::move(BlockReachable)),
97 ContainsExprConsumedInDifferentBlock(
98 std::move(ContainsExprConsumedInDifferentBlock)) {}
99
100
101 const Decl &ContainingDecl;
102 std::unique_ptr Cfg;
103 internal::StmtToBlockMap StmtToBlock;
104 llvm::BitVector BlockReachable;
105 llvm::DenseSet<const CFGBlock *> ContainsExprConsumedInDifferentBlock;
106};
107
108}
109}
110
111#endif
Defines the clang::ASTContext interface.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Represents a single basic block in a source-level CFG.
unsigned getBlockID() const
Represents a source-level, intra-procedural CFG that represents the control-flow of a Stmt.
Decl - This represents one declaration (or definition), e.g.
Represents a function declaration or definition.
Stmt - This represents one statement.
Holds CFG with additional information derived from it that is needed to perform dataflow analysis.
const CFG & getCFG() const
Returns the CFG that is stored in this context.
const CFGBlock * blockForStmt(const Stmt &S) const
Returns the basic block that contains S, or null if no basic block containing S is found.
bool isBlockReachable(const CFGBlock &B) const
Returns whether B is reachable from the entry block.
bool containsExprConsumedInDifferentBlock(const CFGBlock &B) const
Returns whether B contains an expression that is consumed in a different block than B (i....
static llvm::Expected< AdornedCFG > build(const FunctionDecl &Func)
Builds an AdornedCFG from a FunctionDecl.
const Decl & getDecl() const
Returns the Decl containing the statement used to construct the CFG, if available.
const CFGBlock * lookup(const Stmt &S) const
const Expr & ignoreCFGOmittedNodes(const Expr &E)
Skip past nodes that the CFG does not emit.
The JSON file list parser is used to communicate input to InstallAPI.