Skip to content

Commit 98c2a3a

Browse files
Martin Moryvulder
authored andcommitted
clang-tidy fixes for IDE LCA
1 parent 70fb317 commit 98c2a3a

4 files changed

Lines changed: 165 additions & 159 deletions

File tree

include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/IDELinearConstantAnalysis.h

Lines changed: 65 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ class IDELinearConstantAnalysis
4242
: public IDETabulationProblem<IDELinearConstantAnalysisDomain> {
4343
private:
4444
// For debug purpose only
45-
static unsigned CurrGenConstantId;
46-
static unsigned CurrLCAIDId;
47-
static unsigned CurrBinaryId;
45+
static unsigned CurrGenConstantId; // NOLINT
46+
static unsigned CurrLCAIDId; // NOLINT
47+
static unsigned CurrBinaryId; // NOLINT
4848

4949
public:
5050
using IDETabProblemType =
@@ -66,32 +66,35 @@ class IDELinearConstantAnalysis
6666
std::set<std::string> EntryPoints = {"main"});
6767

6868
~IDELinearConstantAnalysis() override;
69+
IDELinearConstantAnalysis(const IDELinearConstantAnalysis &) = delete;
70+
IDELinearConstantAnalysis &
71+
operator=(const IDELinearConstantAnalysis &) = delete;
6972

7073
struct LCAResult {
7174
LCAResult() = default;
72-
unsigned line_nr = 0;
73-
std::string src_code;
74-
std::map<std::string, l_t> variableToValue;
75-
std::vector<n_t> ir_trace;
76-
void print(std::ostream &os);
77-
inline bool operator==(const LCAResult &rhs) const {
78-
return src_code == rhs.src_code &&
79-
variableToValue == rhs.variableToValue && ir_trace == rhs.ir_trace;
75+
unsigned LineNr = 0;
76+
std::string SrcNode;
77+
std::map<std::string, l_t> VariableToValue;
78+
std::vector<n_t> IRTrace;
79+
void print(std::ostream &OS);
80+
inline bool operator==(const LCAResult &Rhs) const {
81+
return SrcNode == Rhs.SrcNode && VariableToValue == Rhs.VariableToValue &&
82+
IRTrace == Rhs.IRTrace;
8083
}
8184

8285
operator std::string() const {
8386
std::stringstream OS;
84-
OS << "Line " << line_nr << ": " << src_code << '\n';
87+
OS << "Line " << LineNr << ": " << SrcNode << '\n';
8588
OS << "Var(s): ";
86-
for (auto It = variableToValue.begin(); It != variableToValue.end();
89+
for (auto It = VariableToValue.begin(); It != VariableToValue.end();
8790
++It) {
88-
if (It != variableToValue.begin()) {
91+
if (It != VariableToValue.begin()) {
8992
OS << ", ";
9093
}
9194
OS << It->first << " = " << It->second;
9295
}
9396
OS << "\nCorresponding IR Instructions:\n";
94-
for (const auto *Ir : ir_trace) {
97+
for (const auto *Ir : IRTrace) {
9598
OS << " " << llvmIRToString(Ir) << '\n';
9699
}
97100
return OS.str();
@@ -104,52 +107,52 @@ class IDELinearConstantAnalysis
104107

105108
// start formulating our analysis by specifying the parts required for IFDS
106109

107-
FlowFunctionPtrType getNormalFlowFunction(n_t curr, n_t succ) override;
110+
FlowFunctionPtrType getNormalFlowFunction(n_t Curr, n_t Succ) override;
108111

109-
FlowFunctionPtrType getCallFlowFunction(n_t callSite, f_t destFun) override;
112+
FlowFunctionPtrType getCallFlowFunction(n_t CallSite, f_t DestFun) override;
110113

111-
FlowFunctionPtrType getRetFlowFunction(n_t callSite, f_t calleeFun,
112-
n_t exitInst, n_t retSite) override;
114+
FlowFunctionPtrType getRetFlowFunction(n_t CallSite, f_t CalleeFun,
115+
n_t ExitInst, n_t RetSite) override;
113116

114-
FlowFunctionPtrType getCallToRetFlowFunction(n_t callSite, n_t retSite,
115-
std::set<f_t> callees) override;
117+
FlowFunctionPtrType getCallToRetFlowFunction(n_t CallSite, n_t RetSite,
118+
std::set<f_t> Callees) override;
116119

117-
FlowFunctionPtrType getSummaryFlowFunction(n_t callSite,
118-
f_t destFun) override;
120+
FlowFunctionPtrType getSummaryFlowFunction(n_t CallSite,
121+
f_t DestFun) override;
119122

120123
InitialSeeds<n_t, d_t, l_t> initialSeeds() override;
121124

122125
d_t createZeroValue() const override;
123126

124-
bool isZeroValue(d_t d) const override;
127+
[[nodiscard]] bool isZeroValue(d_t Fact) const override;
125128

126129
// in addition provide specifications for the IDE parts
127130

128131
std::shared_ptr<EdgeFunction<l_t>>
129-
getNormalEdgeFunction(n_t curr, d_t currNode, n_t succ,
130-
d_t succNode) override;
132+
getNormalEdgeFunction(n_t Curr, d_t CurrNode, n_t Succ,
133+
d_t SuccNode) override;
131134

132135
std::shared_ptr<EdgeFunction<l_t>>
133-
getCallEdgeFunction(n_t callSite, d_t srcNode, f_t destinationFunction,
134-
d_t destNode) override;
136+
getCallEdgeFunction(n_t CallSite, d_t SrcNode, f_t DestinationFunction,
137+
d_t DestNode) override;
135138

136139
std::shared_ptr<EdgeFunction<l_t>>
137-
getReturnEdgeFunction(n_t callSite, f_t calleeFunction, n_t exitInst,
138-
d_t exitNode, n_t reSite, d_t retNode) override;
140+
getReturnEdgeFunction(n_t CallSite, f_t CalleeFunction, n_t ExitStmt,
141+
d_t ExitNode, n_t RetSite, d_t RetNode) override;
139142

140143
std::shared_ptr<EdgeFunction<l_t>>
141-
getCallToRetEdgeFunction(n_t callSite, d_t callNode, n_t retSite,
142-
d_t retSiteNode, std::set<f_t> callees) override;
144+
getCallToRetEdgeFunction(n_t CallSite, d_t CallNode, n_t RetSite,
145+
d_t RetSiteNode, std::set<f_t> Callees) override;
143146

144147
std::shared_ptr<EdgeFunction<l_t>>
145-
getSummaryEdgeFunction(n_t callSite, d_t callNode, n_t retSite,
146-
d_t retSiteNode) override;
148+
getSummaryEdgeFunction(n_t CallSite, d_t CallNode, n_t RetSite,
149+
d_t RetSiteNode) override;
147150

148151
l_t topElement() override;
149152

150153
l_t bottomElement() override;
151154

152-
l_t join(l_t lhs, l_t rhs) override;
155+
l_t join(l_t Lhs, l_t Rhs) override;
153156

154157
std::shared_ptr<EdgeFunction<l_t>> allTopFunction() override;
155158

@@ -162,75 +165,75 @@ class IDELinearConstantAnalysis
162165
: EdgeFunctionComposer<l_t>(F, G){};
163166

164167
std::shared_ptr<EdgeFunction<l_t>>
165-
composeWith(std::shared_ptr<EdgeFunction<l_t>> secondFunction) override;
168+
composeWith(std::shared_ptr<EdgeFunction<l_t>> SecondFunction) override;
166169

167170
std::shared_ptr<EdgeFunction<l_t>>
168-
joinWith(std::shared_ptr<EdgeFunction<l_t>> otherFunction) override;
171+
joinWith(std::shared_ptr<EdgeFunction<l_t>> OtherFunction) override;
169172
};
170173

171174
class GenConstant : public EdgeFunction<l_t>,
172175
public std::enable_shared_from_this<GenConstant> {
173176
private:
174-
const unsigned GenConstant_Id;
177+
const unsigned GenConstantId;
175178
const l_t IntConst;
176179

177180
public:
178181
explicit GenConstant(l_t IntConst);
179182

180-
l_t computeTarget(l_t source) override;
183+
l_t computeTarget(l_t Source) override;
181184

182185
std::shared_ptr<EdgeFunction<l_t>>
183-
composeWith(std::shared_ptr<EdgeFunction<l_t>> secondFunction) override;
186+
composeWith(std::shared_ptr<EdgeFunction<l_t>> SecondFunction) override;
184187

185188
std::shared_ptr<EdgeFunction<l_t>>
186-
joinWith(std::shared_ptr<EdgeFunction<l_t>> otherFunction) override;
189+
joinWith(std::shared_ptr<EdgeFunction<l_t>> OtherFunction) override;
187190

188-
bool equal_to(std::shared_ptr<EdgeFunction<l_t>> other) const override;
191+
bool equal_to(std::shared_ptr<EdgeFunction<l_t>> Other) const override;
189192

190-
void print(std::ostream &OS, bool isForDebug = false) const override;
193+
void print(std::ostream &OS, bool IsForDebug = false) const override;
191194
};
192195

193196
class LCAIdentity : public EdgeFunction<l_t>,
194197
public std::enable_shared_from_this<LCAIdentity> {
195198
private:
196-
const unsigned LCAID_Id;
199+
const unsigned LCAIDId;
197200

198201
public:
199202
explicit LCAIdentity();
200203

201-
l_t computeTarget(l_t source) override;
204+
l_t computeTarget(l_t Source) override;
202205

203206
std::shared_ptr<EdgeFunction<l_t>>
204-
composeWith(std::shared_ptr<EdgeFunction<l_t>> secondFunction) override;
207+
composeWith(std::shared_ptr<EdgeFunction<l_t>> SecondFunction) override;
205208

206209
std::shared_ptr<EdgeFunction<l_t>>
207-
joinWith(std::shared_ptr<EdgeFunction<l_t>> otherFunction) override;
210+
joinWith(std::shared_ptr<EdgeFunction<l_t>> OtherFunction) override;
208211

209-
bool equal_to(std::shared_ptr<EdgeFunction<l_t>> other) const override;
212+
bool equal_to(std::shared_ptr<EdgeFunction<l_t>> Other) const override;
210213

211-
void print(std::ostream &OS, bool isForDebug = false) const override;
214+
void print(std::ostream &OS, bool IsForDebug = false) const override;
212215
};
213216

214217
class BinOp : public EdgeFunction<l_t>,
215218
public std::enable_shared_from_this<BinOp> {
216219
private:
217220
const unsigned EdgeFunctionID, Op;
218-
d_t lop, rop, currNode;
221+
d_t Lop, Rop, CurrNode;
219222

220223
public:
221-
BinOp(const unsigned Op, d_t lop, d_t rop, d_t currNode);
224+
BinOp(unsigned Op, d_t Lop, d_t Rop, d_t CurrNode);
222225

223-
l_t computeTarget(l_t source) override;
226+
l_t computeTarget(l_t Source) override;
224227

225228
std::shared_ptr<EdgeFunction<l_t>>
226-
composeWith(std::shared_ptr<EdgeFunction<l_t>> secondFunction) override;
229+
composeWith(std::shared_ptr<EdgeFunction<l_t>> SecondFunction) override;
227230

228231
std::shared_ptr<EdgeFunction<l_t>>
229-
joinWith(std::shared_ptr<EdgeFunction<l_t>> otherFunction) override;
232+
joinWith(std::shared_ptr<EdgeFunction<l_t>> OtherFunction) override;
230233

231-
bool equal_to(std::shared_ptr<EdgeFunction<l_t>> other) const override;
234+
bool equal_to(std::shared_ptr<EdgeFunction<l_t>> Other) const override;
232235

233-
void print(std::ostream &OS, bool isForDebug = false) const override;
236+
void print(std::ostream &OS, bool IsForDebug = false) const override;
234237
};
235238

236239
// Helper functions
@@ -249,19 +252,19 @@ class IDELinearConstantAnalysis
249252
* @param rop right operand
250253
* @return Result of binary operation
251254
*/
252-
static l_t executeBinOperation(const unsigned op, l_t lop, l_t rop);
255+
static l_t executeBinOperation(unsigned Op, l_t Lop, l_t Rop);
253256

254-
static char opToChar(const unsigned op);
257+
static char opToChar(unsigned Op);
255258

256259
bool isEntryPoint(const std::string &FunctionName) const;
257260

258-
void printNode(std::ostream &os, n_t n) const override;
261+
void printNode(std::ostream &OS, n_t Stmt) const override;
259262

260-
void printDataFlowFact(std::ostream &os, d_t d) const override;
263+
void printDataFlowFact(std::ostream &OS, d_t Fact) const override;
261264

262-
void printFunction(std::ostream &os, f_t m) const override;
265+
void printFunction(std::ostream &OS, f_t Func) const override;
263266

264-
void printEdgeFact(std::ostream &os, l_t l) const override;
267+
void printEdgeFact(std::ostream &OS, l_t L) const override;
265268

266269
lca_results_t getLCAResults(SolverResults<n_t, d_t, l_t> SR);
267270

0 commit comments

Comments
 (0)