@@ -42,9 +42,9 @@ class IDELinearConstantAnalysis
4242 : public IDETabulationProblem<IDELinearConstantAnalysisDomain> {
4343private:
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
4949public:
5050 using IDETabProblemType =
@@ -67,33 +67,35 @@ class IDELinearConstantAnalysis
6767
6868 ~IDELinearConstantAnalysis () override ;
6969
70+ IDELinearConstantAnalysis (const IDELinearConstantAnalysis &) = delete ;
7071 IDELinearConstantAnalysis &
7172 operator =(const IDELinearConstantAnalysis &) = delete ;
73+
7274 struct LCAResult {
7375 LCAResult () = default ;
74- unsigned line_nr = 0 ;
75- std::string src_code ;
76- std::map<std::string, l_t > variableToValue ;
77- std::vector<n_t > ir_trace ;
78- void print (std::ostream &os );
79- inline bool operator ==(const LCAResult &rhs ) const {
80- return src_code == rhs. src_code &&
81- variableToValue == rhs. variableToValue && ir_trace == rhs. ir_trace ;
76+ unsigned LineNr = 0 ;
77+ std::string SrcNode ;
78+ std::map<std::string, l_t > VariableToValue ;
79+ std::vector<n_t > IRTrace ;
80+ void print (std::ostream &OS );
81+ inline bool operator ==(const LCAResult &Rhs ) const {
82+ return SrcNode == Rhs. SrcNode && VariableToValue == Rhs. VariableToValue &&
83+ IRTrace == Rhs. IRTrace ;
8284 }
8385
8486 operator std::string () const {
8587 std::stringstream OS;
86- OS << " Line " << line_nr << " : " << src_code << ' \n ' ;
88+ OS << " Line " << LineNr << " : " << SrcNode << ' \n ' ;
8789 OS << " Var(s): " ;
88- for (auto It = variableToValue .begin (); It != variableToValue .end ();
90+ for (auto It = VariableToValue .begin (); It != VariableToValue .end ();
8991 ++It) {
90- if (It != variableToValue .begin ()) {
92+ if (It != VariableToValue .begin ()) {
9193 OS << " , " ;
9294 }
9395 OS << It->first << " = " << It->second ;
9496 }
9597 OS << " \n Corresponding IR Instructions:\n " ;
96- for (const auto *Ir : ir_trace ) {
98+ for (const auto *Ir : IRTrace ) {
9799 OS << " " << llvmIRToString (Ir) << ' \n ' ;
98100 }
99101 return OS.str ();
@@ -106,52 +108,52 @@ class IDELinearConstantAnalysis
106108
107109 // start formulating our analysis by specifying the parts required for IFDS
108110
109- FlowFunctionPtrType getNormalFlowFunction (n_t curr , n_t succ ) override ;
111+ FlowFunctionPtrType getNormalFlowFunction (n_t Curr , n_t Succ ) override ;
110112
111- FlowFunctionPtrType getCallFlowFunction (n_t callSite , f_t destFun ) override ;
113+ FlowFunctionPtrType getCallFlowFunction (n_t CallSite , f_t DestFun ) override ;
112114
113- FlowFunctionPtrType getRetFlowFunction (n_t callSite , f_t calleeFun ,
114- n_t exitInst , n_t retSite ) override ;
115+ FlowFunctionPtrType getRetFlowFunction (n_t CallSite , f_t CalleeFun ,
116+ n_t ExitInst , n_t RetSite ) override ;
115117
116- FlowFunctionPtrType getCallToRetFlowFunction (n_t callSite , n_t retSite ,
117- std::set<f_t > callees ) override ;
118+ FlowFunctionPtrType getCallToRetFlowFunction (n_t CallSite , n_t RetSite ,
119+ std::set<f_t > Callees ) override ;
118120
119- FlowFunctionPtrType getSummaryFlowFunction (n_t callSite ,
120- f_t destFun ) override ;
121+ FlowFunctionPtrType getSummaryFlowFunction (n_t CallSite ,
122+ f_t DestFun ) override ;
121123
122124 [[nodiscard]] InitialSeeds<n_t , d_t , l_t > initialSeeds () override ;
123125
124126 [[nodiscard]] d_t createZeroValue () const override ;
125127
126- bool isZeroValue (d_t d ) const override ;
128+ [[nodiscard]] bool isZeroValue (d_t Fact ) const override ;
127129
128130 // in addition provide specifications for the IDE parts
129131
130132 std::shared_ptr<EdgeFunction<l_t >>
131- getNormalEdgeFunction (n_t curr , d_t currNode , n_t succ ,
132- d_t succNode ) override ;
133+ getNormalEdgeFunction (n_t Curr , d_t CurrNode , n_t Succ ,
134+ d_t SuccNode ) override ;
133135
134136 std::shared_ptr<EdgeFunction<l_t >>
135- getCallEdgeFunction (n_t callSite , d_t srcNode , f_t destinationFunction ,
136- d_t destNode ) override ;
137+ getCallEdgeFunction (n_t CallSite , d_t SrcNode , f_t DestinationFunction ,
138+ d_t DestNode ) override ;
137139
138140 std::shared_ptr<EdgeFunction<l_t >>
139- getReturnEdgeFunction (n_t callSite , f_t calleeFunction , n_t exitInst ,
140- d_t exitNode , n_t reSite , d_t retNode ) override ;
141+ getReturnEdgeFunction (n_t CallSite , f_t CalleeFunction , n_t ExitStmt ,
142+ d_t ExitNode , n_t RetSite , d_t RetNode ) override ;
141143
142144 std::shared_ptr<EdgeFunction<l_t >>
143- getCallToRetEdgeFunction (n_t callSite , d_t callNode , n_t retSite ,
144- d_t retSiteNode , std::set<f_t > callees ) override ;
145+ getCallToRetEdgeFunction (n_t CallSite , d_t CallNode , n_t RetSite ,
146+ d_t RetSiteNode , std::set<f_t > Callees ) override ;
145147
146148 std::shared_ptr<EdgeFunction<l_t >>
147- getSummaryEdgeFunction (n_t callSite , d_t callNode , n_t retSite ,
148- d_t retSiteNode ) override ;
149+ getSummaryEdgeFunction (n_t CallSite , d_t CallNode , n_t RetSite ,
150+ d_t RetSiteNode ) override ;
149151
150152 l_t topElement () override ;
151153
152154 l_t bottomElement () override ;
153155
154- l_t join (l_t lhs , l_t rhs ) override ;
156+ l_t join (l_t Lhs , l_t Rhs ) override ;
155157
156158 std::shared_ptr<EdgeFunction<l_t >> allTopFunction () override ;
157159
@@ -164,75 +166,75 @@ class IDELinearConstantAnalysis
164166 : EdgeFunctionComposer<l_t >(F, G){};
165167
166168 std::shared_ptr<EdgeFunction<l_t >>
167- composeWith (std::shared_ptr<EdgeFunction<l_t >> secondFunction ) override ;
169+ composeWith (std::shared_ptr<EdgeFunction<l_t >> SecondFunction ) override ;
168170
169171 std::shared_ptr<EdgeFunction<l_t >>
170- joinWith (std::shared_ptr<EdgeFunction<l_t >> otherFunction ) override ;
172+ joinWith (std::shared_ptr<EdgeFunction<l_t >> OtherFunction ) override ;
171173 };
172174
173175 class GenConstant : public EdgeFunction <l_t >,
174176 public std::enable_shared_from_this<GenConstant> {
175177 private:
176- const unsigned GenConstant_Id ;
178+ const unsigned GenConstantId ;
177179 const l_t IntConst;
178180
179181 public:
180182 explicit GenConstant (l_t IntConst);
181183
182- l_t computeTarget (l_t source ) override ;
184+ l_t computeTarget (l_t Source ) override ;
183185
184186 std::shared_ptr<EdgeFunction<l_t >>
185- composeWith (std::shared_ptr<EdgeFunction<l_t >> secondFunction ) override ;
187+ composeWith (std::shared_ptr<EdgeFunction<l_t >> SecondFunction ) override ;
186188
187189 std::shared_ptr<EdgeFunction<l_t >>
188- joinWith (std::shared_ptr<EdgeFunction<l_t >> otherFunction ) override ;
190+ joinWith (std::shared_ptr<EdgeFunction<l_t >> OtherFunction ) override ;
189191
190- bool equal_to (std::shared_ptr<EdgeFunction<l_t >> other ) const override ;
192+ bool equal_to (std::shared_ptr<EdgeFunction<l_t >> Other ) const override ;
191193
192- void print (std::ostream &OS, bool isForDebug = false ) const override ;
194+ void print (std::ostream &OS, bool IsForDebug = false ) const override ;
193195 };
194196
195197 class LCAIdentity : public EdgeFunction <l_t >,
196198 public std::enable_shared_from_this<LCAIdentity> {
197199 private:
198- const unsigned LCAID_Id ;
200+ const unsigned LCAIDId ;
199201
200202 public:
201203 explicit LCAIdentity ();
202204
203- l_t computeTarget (l_t source ) override ;
205+ l_t computeTarget (l_t Source ) override ;
204206
205207 std::shared_ptr<EdgeFunction<l_t >>
206- composeWith (std::shared_ptr<EdgeFunction<l_t >> secondFunction ) override ;
208+ composeWith (std::shared_ptr<EdgeFunction<l_t >> SecondFunction ) override ;
207209
208210 std::shared_ptr<EdgeFunction<l_t >>
209- joinWith (std::shared_ptr<EdgeFunction<l_t >> otherFunction ) override ;
211+ joinWith (std::shared_ptr<EdgeFunction<l_t >> OtherFunction ) override ;
210212
211- bool equal_to (std::shared_ptr<EdgeFunction<l_t >> other ) const override ;
213+ bool equal_to (std::shared_ptr<EdgeFunction<l_t >> Other ) const override ;
212214
213- void print (std::ostream &OS, bool isForDebug = false ) const override ;
215+ void print (std::ostream &OS, bool IsForDebug = false ) const override ;
214216 };
215217
216218 class BinOp : public EdgeFunction <l_t >,
217219 public std::enable_shared_from_this<BinOp> {
218220 private:
219221 const unsigned EdgeFunctionID, Op;
220- d_t lop, rop, currNode ;
222+ d_t Lop, Rop, CurrNode ;
221223
222224 public:
223- BinOp (const unsigned Op, d_t lop , d_t rop , d_t currNode );
225+ BinOp (unsigned Op, d_t Lop , d_t Rop , d_t CurrNode );
224226
225- l_t computeTarget (l_t source ) override ;
227+ l_t computeTarget (l_t Source ) override ;
226228
227229 std::shared_ptr<EdgeFunction<l_t >>
228- composeWith (std::shared_ptr<EdgeFunction<l_t >> secondFunction ) override ;
230+ composeWith (std::shared_ptr<EdgeFunction<l_t >> SecondFunction ) override ;
229231
230232 std::shared_ptr<EdgeFunction<l_t >>
231- joinWith (std::shared_ptr<EdgeFunction<l_t >> otherFunction ) override ;
233+ joinWith (std::shared_ptr<EdgeFunction<l_t >> OtherFunction ) override ;
232234
233- bool equal_to (std::shared_ptr<EdgeFunction<l_t >> other ) const override ;
235+ bool equal_to (std::shared_ptr<EdgeFunction<l_t >> Other ) const override ;
234236
235- void print (std::ostream &OS, bool isForDebug = false ) const override ;
237+ void print (std::ostream &OS, bool IsForDebug = false ) const override ;
236238 };
237239
238240 // Helper functions
@@ -251,19 +253,19 @@ class IDELinearConstantAnalysis
251253 * @param rop right operand
252254 * @return Result of binary operation
253255 */
254- static l_t executeBinOperation (const unsigned op , l_t lop , l_t rop );
256+ static l_t executeBinOperation (unsigned Op , l_t Lop , l_t Rop );
255257
256- static char opToChar (const unsigned op );
258+ static char opToChar (unsigned Op );
257259
258260 [[nodiscard]] bool isEntryPoint (const std::string &FunctionName) const ;
259261
260- void printNode (std::ostream &os , n_t n ) const override ;
262+ void printNode (std::ostream &OS , n_t Stmt ) const override ;
261263
262- void printDataFlowFact (std::ostream &os , d_t d ) const override ;
264+ void printDataFlowFact (std::ostream &OS , d_t Fact ) const override ;
263265
264- void printFunction (std::ostream &os , f_t m ) const override ;
266+ void printFunction (std::ostream &OS , f_t Func ) const override ;
265267
266- void printEdgeFact (std::ostream &os , l_t l ) const override ;
268+ void printEdgeFact (std::ostream &OS , l_t L ) const override ;
267269
268270 [[nodiscard]] lca_results_t getLCAResults (SolverResults<n_t , d_t , l_t > SR);
269271
0 commit comments