7
7
8
8
namespace {
9
9
10
- void populateWithMayAliases (psr::LLVMAliasInfoRef AS,
11
- std::set<const llvm::Value *> &Facts);
10
+ void populateWithMayAliases (psr::LLVMAliasIteratorRef AS,
11
+ std::set<const llvm::Value *> &Facts,
12
+ const llvm::Instruction *At);
12
13
13
14
// / To create a custom IFDS analysis, we must create a subclass of the
14
15
// / IFDSTabulationProblem.
@@ -23,7 +24,7 @@ class ExampleTaintAnalysis : public psr::DefaultAliasAwareIFDSProblem {
23
24
// / The last parameter of the base-ctor denotes the special zero-value of the
24
25
// / IFDS problem. We use LLVMZeroValue for this.
25
26
explicit ExampleTaintAnalysis (const psr::LLVMProjectIRDB *IRDB,
26
- psr::LLVMAliasInfoRef AS,
27
+ psr::LLVMAliasIteratorRef AS,
27
28
const psr::LLVMTaintConfig *Config,
28
29
std::vector<std::string> EntryPoints)
29
30
: psr::DefaultAliasAwareIFDSProblem(IRDB, AS, std::move(EntryPoints),
@@ -63,8 +64,8 @@ class ExampleTaintAnalysis : public psr::DefaultAliasAwareIFDSProblem {
63
64
}
64
65
65
66
// Since our analysis is alias-aware, we must handle aliasing here:
66
- populateWithMayAliases (getAliasInfo (), Gen);
67
- populateWithMayAliases (getAliasInfo (), Leak);
67
+ populateWithMayAliases (getAliasInfo (), Gen, CallSite );
68
+ populateWithMayAliases (getAliasInfo (), Leak, CallSite );
68
69
69
70
// We have special behavior to communicate to the analysis solver, so create
70
71
// a flow-function that captures this behavior:
@@ -101,12 +102,12 @@ class ExampleTaintAnalysis : public psr::DefaultAliasAwareIFDSProblem {
101
102
};
102
103
103
104
// For all given facts, we add their aliases:
104
- void populateWithMayAliases (psr::LLVMAliasInfoRef AS,
105
- std::set<const llvm::Value *> &Facts) {
105
+ void populateWithMayAliases (psr::LLVMAliasIteratorRef AS,
106
+ std::set<const llvm::Value *> &Facts,
107
+ const llvm::Instruction *At) {
106
108
auto Tmp = Facts;
107
109
for (const auto *Fact : Facts) {
108
- auto Aliases = AS.getAliasSet (Fact);
109
- Tmp.insert (Aliases->begin (), Aliases->end ());
110
+ AS.forallAliasesOf (Fact, At, [&](const auto *Alias) { Tmp.insert (Alias); });
110
111
}
111
112
112
113
Facts = std::move (Tmp);
0 commit comments