Skip to content

Commit 59e1ea6

Browse files
committed
Merge branch 'development' into f-LCAImprovements
2 parents f44634a + b814381 commit 59e1ea6

17 files changed

Lines changed: 985 additions & 972 deletions

File tree

.clang-tidy

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Checks: '-*,
55
-misc-non-private-member-variables-in-classes,
66
-misc-no-recursion,
77
readability-*,
8+
-readability-function-cognitive-complexity,
89
-readability-else-after*,
910
-readability-simplify-boolean-expr,
1011
-readability-implicit-bool-cast,
@@ -48,6 +49,10 @@ CheckOptions:
4849
value: CamelCase
4950
- key: readability-identifier-naming.VariableCase
5051
value: CamelCase
52+
- key: readability-identifier-naming.VariableIgnoredRegexp
53+
value: (c|d|d1|d2|d3|d4|d5|d5_restoredCtx|eP|f|f3|f4|f5|fCalleeSummary|g|n|dPrime|fPrime)
54+
- key: readability-identifier-naming.ParameterIgnoredRegexp
55+
value: (d|d1|d2|d3|d4|d5|eP|f|n)
5156
- key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor
5257
value: 1
5358
- key: cppcoreguidelines-special-member-functions.AllowMissingMoveFunctions

include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Solver/IDESolver.h

Lines changed: 563 additions & 563 deletions
Large diffs are not rendered by default.

include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Solver/IDESummaryGenerator.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,35 +29,35 @@ template <typename N, typename D, typename F, typename I, typename V,
2929
typename ConcreteTabulationProblem, typename ConcreteSolver>
3030
class IDESummaryGenerator {
3131
protected:
32-
const std::string toSummarize;
33-
const I icfg;
32+
const std::string ToSummarize;
33+
const I ICFG;
3434
const SummaryGenerationStrategy CTXStrategy;
3535

3636
class CTXFunctionProblem : public ConcreteTabulationProblem {
3737
public:
38-
const N start;
39-
std::set<D> facts;
38+
const N Start;
39+
std::set<D> Facts;
4040

41-
CTXFunctionProblem(N start, std::set<D> facts, I icfg)
42-
: ConcreteTabulationProblem(icfg), start(start), facts(facts) {
41+
CTXFunctionProblem(N Start, std::set<D> Facts, I ICFG)
42+
: ConcreteTabulationProblem(ICFG), Start(Start), Facts(Facts) {
4343
this->solver_config.followReturnsPastSeeds = false;
4444
this->solver_config.autoAddZero = true;
4545
this->solver_config.computeValues = true;
4646
this->solver_config.recordEdges = false;
4747
this->solver_config.computePersistedSummaries = false;
4848
}
4949

50-
virtual std::map<N, std::set<D>> initialSeeds() override {
51-
std::map<N, std::set<D>> seeds;
52-
seeds.insert(make_pair(start, facts));
53-
return seeds;
50+
std::map<N, std::set<D>> initialSeeds() override {
51+
std::map<N, std::set<D>> Seeds;
52+
Seeds.insert({Start, Facts});
53+
return Seeds;
5454
}
5555
};
5656

5757
public:
5858
IDESummaryGenerator(std::string Function, I Icfg,
5959
SummaryGenerationStrategy Strategy)
60-
: toSummarize(Function), icfg(Icfg), CTXStrategy(Strategy) {}
60+
: ToSummarize(std::move(Function)), ICFG(Icfg), CTXStrategy(Strategy) {}
6161
virtual ~IDESummaryGenerator() = default;
6262
void generateSummaries() {
6363
// initialize the input combinations that should be considered

include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Solver/IFDSSolver.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class IFDSSolver : public IDESolver<AnalysisDomainExtender<AnalysisDomainTy>> {
4848
[[nodiscard]] virtual std::set<D> ifdsResultsAt(N Inst) {
4949
std::set<D> KeySet;
5050
std::unordered_map<D, BinaryDomain> ResultMap = this->resultsAt(Inst);
51-
for (auto FlowFact : ResultMap) {
51+
for (const auto &FlowFact : ResultMap) {
5252
KeySet.insert(FlowFact.first);
5353
}
5454
return KeySet;
@@ -74,18 +74,18 @@ class IFDSSolver : public IDESolver<AnalysisDomainExtender<AnalysisDomainTy>> {
7474
std::is_same_v<std::remove_reference_t<NTy>, llvm::Instruction *>,
7575
std::set<D>>
7676
ifdsResultsAtInLLVMSSA(NTy Inst) {
77-
auto getResultMap = [this, Inst]() {
78-
if (Inst->getType()->isVoidTy()) {
79-
return this->resultsAt(Inst);
80-
} else {
81-
// In this case we have a value on the left-hand side and must return
82-
// the results at the successor instruction. Note that terminator
83-
// instructions are always of void type.
84-
assert(Inst->getNextNode() &&
85-
"Expected to find a valid successor node!");
86-
return this->resultsAt(Inst->getNextNode());
87-
}
88-
};
77+
auto getResultMap // NOLINT
78+
= [this, Inst]() {
79+
if (Inst->getType()->isVoidTy()) {
80+
return this->resultsAt(Inst);
81+
}
82+
// In this case we have a value on the left-hand side and must
83+
// return the results at the successor instruction. Note that
84+
// terminator instructions are always of void type.
85+
assert(Inst->getNextNode() &&
86+
"Expected to find a valid successor node!");
87+
return this->resultsAt(Inst->getNextNode());
88+
};
8989
std::set<D> KeySet;
9090
for (auto &[FlowFact, LatticeValue] : getResultMap()) {
9191
KeySet.insert(FlowFact);

include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Solver/IFDSToIDETabulationProblem.h

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct AnalysisDomainExtender : public OriginalAnalysisDomain {
3737
};
3838

3939
template <typename, typename = void>
40-
struct is_analysis_domain_extensions : std::false_type {};
40+
struct is_analysis_domain_extensions : std::false_type {}; // NOLINT
4141

4242
template <typename AnalysisDomainTy>
4343
struct is_analysis_domain_extensions<
@@ -75,27 +75,27 @@ class IFDSToIDETabulationProblem
7575
this->ZeroValue = Problem.createZeroValue();
7676
}
7777

78-
FlowFunctionPtrType getNormalFlowFunction(n_t curr, n_t succ) override {
79-
return Problem.getNormalFlowFunction(curr, succ);
78+
FlowFunctionPtrType getNormalFlowFunction(n_t Curr, n_t Succ) override {
79+
return Problem.getNormalFlowFunction(Curr, Succ);
8080
}
8181

82-
FlowFunctionPtrType getCallFlowFunction(n_t callSite, f_t destFun) override {
83-
return Problem.getCallFlowFunction(callSite, destFun);
82+
FlowFunctionPtrType getCallFlowFunction(n_t CallSite, f_t DestFun) override {
83+
return Problem.getCallFlowFunction(CallSite, DestFun);
8484
}
8585

86-
FlowFunctionPtrType getRetFlowFunction(n_t callSite, f_t calleeFun,
87-
n_t exitInst, n_t retSite) override {
88-
return Problem.getRetFlowFunction(callSite, calleeFun, exitInst, retSite);
86+
FlowFunctionPtrType getRetFlowFunction(n_t CallSite, f_t CalleeFun,
87+
n_t ExitInst, n_t RetSite) override {
88+
return Problem.getRetFlowFunction(CallSite, CalleeFun, ExitInst, RetSite);
8989
}
9090

91-
FlowFunctionPtrType getCallToRetFlowFunction(n_t callSite, n_t retSite,
92-
std::set<f_t> callees) override {
93-
return Problem.getCallToRetFlowFunction(callSite, retSite, callees);
91+
FlowFunctionPtrType getCallToRetFlowFunction(n_t CallSite, n_t RetSite,
92+
std::set<f_t> Callees) override {
93+
return Problem.getCallToRetFlowFunction(CallSite, RetSite, Callees);
9494
}
9595

96-
FlowFunctionPtrType getSummaryFlowFunction(n_t callSite,
97-
f_t destFun) override {
98-
return Problem.getSummaryFlowFunction(callSite, destFun);
96+
FlowFunctionPtrType getSummaryFlowFunction(n_t CallSite,
97+
f_t DestFun) override {
98+
return Problem.getSummaryFlowFunction(CallSite, DestFun);
9999
}
100100

101101
InitialSeeds<n_t, d_t, l_t> initialSeeds() override {
@@ -114,73 +114,75 @@ class IFDSToIDETabulationProblem
114114

115115
BinaryDomain bottomElement() override { return BinaryDomain::BOTTOM; }
116116

117-
BinaryDomain join(BinaryDomain left, BinaryDomain right) override {
118-
if (left == BinaryDomain::TOP && right == BinaryDomain::TOP) {
117+
BinaryDomain join(BinaryDomain Lhs, BinaryDomain Rhs) override {
118+
if (Lhs == BinaryDomain::TOP && Rhs == BinaryDomain::TOP) {
119119
return BinaryDomain::TOP;
120-
} else {
121-
return BinaryDomain::BOTTOM;
122120
}
121+
return BinaryDomain::BOTTOM;
123122
}
124123

125124
std::shared_ptr<EdgeFunction<BinaryDomain>> allTopFunction() override {
126125
return std::make_shared<AllTop<BinaryDomain>>(BinaryDomain::TOP);
127126
}
128127

129128
std::shared_ptr<EdgeFunction<BinaryDomain>>
130-
getNormalEdgeFunction(n_t src, d_t srcNode, n_t tgt, d_t tgtNode) override {
131-
if (Problem.isZeroValue(srcNode)) {
129+
getNormalEdgeFunction(n_t /*Src*/, d_t SrcNode, n_t /*Tgt*/,
130+
d_t /*TgtNode*/) override {
131+
if (Problem.isZeroValue(SrcNode)) {
132132
return ALLBOTTOM;
133133
}
134134
return EdgeIdentity<BinaryDomain>::getInstance();
135135
}
136136

137137
std::shared_ptr<EdgeFunction<BinaryDomain>>
138-
getCallEdgeFunction(n_t callSite, d_t srcNode, f_t destinationFunction,
139-
d_t destNode) override {
140-
if (Problem.isZeroValue(srcNode)) {
138+
getCallEdgeFunction(n_t /*CallSite*/, d_t SrcNode,
139+
f_t /*DestinationFunction*/, d_t /*DestNode*/) override {
140+
if (Problem.isZeroValue(SrcNode)) {
141141
return ALLBOTTOM;
142142
}
143143
return EdgeIdentity<BinaryDomain>::getInstance();
144144
}
145145

146146
std::shared_ptr<EdgeFunction<BinaryDomain>>
147-
getReturnEdgeFunction(n_t callSite, f_t calleeFunction, n_t exitInst,
148-
d_t exitNode, n_t returnSite, d_t retNode) override {
149-
if (Problem.isZeroValue(exitNode)) {
147+
getReturnEdgeFunction(n_t /*CallSite*/, f_t /*CalleeFunction*/,
148+
n_t /*ExitInst*/, d_t ExitNode, n_t /*ReturnSite*/,
149+
d_t /*RetNode*/) override {
150+
if (Problem.isZeroValue(ExitNode)) {
150151
return ALLBOTTOM;
151152
}
152153
return EdgeIdentity<BinaryDomain>::getInstance();
153154
}
154155

155156
std::shared_ptr<EdgeFunction<BinaryDomain>>
156-
getCallToRetEdgeFunction(n_t callSite, d_t callNode, n_t returnSite,
157-
d_t returnSideNode, std::set<f_t> callees) override {
158-
if (Problem.isZeroValue(callNode)) {
157+
getCallToRetEdgeFunction(n_t /*CallSite*/, d_t CallNode, n_t /*ReturnSite*/,
158+
d_t /*ReturnSideNode*/,
159+
std::set<f_t> /*Callees*/) override {
160+
if (Problem.isZeroValue(CallNode)) {
159161
return ALLBOTTOM;
160162
}
161163
return EdgeIdentity<BinaryDomain>::getInstance();
162164
}
163165

164166
std::shared_ptr<EdgeFunction<BinaryDomain>>
165-
getSummaryEdgeFunction(n_t callSite, d_t callNode, n_t retSite,
166-
d_t retSiteNode) override {
167+
getSummaryEdgeFunction(n_t /*CallSite*/, d_t /*CallNode*/, n_t /*RetSite*/,
168+
d_t /*RetSiteNode*/) override {
167169
return EdgeIdentity<BinaryDomain>::getInstance();
168170
}
169171

170-
void printNode(std::ostream &os, n_t n) const override {
171-
Problem.printNode(os, n);
172+
void printNode(std::ostream &OS, n_t Stmt) const override {
173+
Problem.printNode(OS, Stmt);
172174
}
173175

174-
void printDataFlowFact(std::ostream &os, d_t d) const override {
175-
Problem.printDataFlowFact(os, d);
176+
void printDataFlowFact(std::ostream &OS, d_t Fact) const override {
177+
Problem.printDataFlowFact(OS, Fact);
176178
}
177179

178-
void printFunction(std::ostream &os, f_t f) const override {
179-
Problem.printFunction(os, f);
180+
void printFunction(std::ostream &OS, f_t Func) const override {
181+
Problem.printFunction(OS, Func);
180182
}
181183

182-
void printEdgeFact(std::ostream &os, BinaryDomain v) const override {
183-
os << v;
184+
void printEdgeFact(std::ostream &OS, BinaryDomain Val) const override {
185+
OS << Val;
184186
}
185187

186188
void emitTextReport(const SolverResults<n_t, d_t, l_t> &Results,

include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Solver/JoinHandlingNode.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ namespace psr {
2424
template <typename T> class JoinHandlingNode {
2525
public:
2626
virtual ~JoinHandlingNode();
27+
JoinHandlingNode(JoinHandlingNode &Other) = delete;
2728
JoinHandlingNode &operator=(JoinHandlingNode &Other) = delete;
2829
/**
2930
*
@@ -33,19 +34,19 @@ template <typename T> class JoinHandlingNode {
3334
* {@code joiningNode} is necessary, otherwise false meaning
3435
* the node should be propagated by the solver.
3536
*/
36-
virtual bool handleJoin(T joiningNode) = 0;
37+
virtual bool handleJoin(T JoiningNode) = 0;
3738

3839
class JoinKey {
3940
private:
40-
std::vector<T> elements;
41+
std::vector<T> Elements;
4142

4243
public:
4344
/**
4445
*
4546
* @param elements Passed elements must be immutable with respect to their
4647
* hashCode and equals implementations.
4748
*/
48-
JoinKey(std::vector<T> elems) : elements(elems) {}
49+
JoinKey(std::vector<T> Elems) : Elements(Elems) {}
4950
int hash() { return 0; }
5051
bool equals() { return false; }
5152
};

0 commit comments

Comments
 (0)