@@ -72,26 +72,38 @@ class IRForTarget : public llvm::ModulePass
72
72
// ------------------------------------------------------------------
73
73
// / Run this IR transformer on a single module
74
74
// /
75
- // / @param[in] M
75
+ // / Implementation of the llvm::ModulePass::runOnModule() function.
76
+ // /
77
+ // / @param[in] llvm_module
76
78
// / The module to run on. This module is searched for the function
77
79
// / $__lldb_expr, and that function is passed to the passes one by
78
80
// / one.
79
81
// /
80
82
// / @return
81
83
// / True on success; false otherwise
82
84
// ------------------------------------------------------------------
83
- bool runOnModule (llvm::Module &M);
85
+ virtual bool
86
+ runOnModule (llvm::Module &llvm_module);
84
87
85
88
// ------------------------------------------------------------------
86
89
// / Interface stub
90
+ // /
91
+ // / Implementation of the llvm::ModulePass::assignPassManager()
92
+ // / function.
87
93
// ------------------------------------------------------------------
88
- void assignPassManager (llvm::PMStack &PMS,
89
- llvm::PassManagerType T = llvm::PMT_ModulePassManager);
94
+ virtual void
95
+ assignPassManager (llvm::PMStack &pass_mgr_stack,
96
+ llvm::PassManagerType pass_mgr_type = llvm::PMT_ModulePassManager);
90
97
91
98
// ------------------------------------------------------------------
92
99
// / Returns PMT_ModulePassManager
100
+ // /
101
+ // / Implementation of the llvm::ModulePass::getPotentialPassManagerType()
102
+ // / function.
93
103
// ------------------------------------------------------------------
94
- llvm::PassManagerType getPotentialPassManagerType () const ;
104
+ virtual llvm::PassManagerType
105
+ getPotentialPassManagerType () const ;
106
+
95
107
private:
96
108
// ------------------------------------------------------------------
97
109
// / A function-level pass to take the generated global value
@@ -102,17 +114,18 @@ class IRForTarget : public llvm::ModulePass
102
114
// ------------------------------------------------------------------
103
115
// / The top-level pass implementation
104
116
// /
105
- // / @param[in] M
117
+ // / @param[in] llvm_module
106
118
// / The module currently being processed.
107
119
// /
108
- // / @param[in] F
120
+ // / @param[in] llvm_function
109
121
// / The function currently being processed.
110
122
// /
111
123
// / @return
112
124
// / True on success; false otherwise
113
125
// ------------------------------------------------------------------
114
- bool createResultVariable (llvm::Module &M,
115
- llvm::Function &F);
126
+ bool
127
+ CreateResultVariable (llvm::Module &llvm_module,
128
+ llvm::Function &llvm_function);
116
129
117
130
// ------------------------------------------------------------------
118
131
// / A function-level pass to find Objective-C constant strings and
@@ -122,7 +135,7 @@ class IRForTarget : public llvm::ModulePass
122
135
// ------------------------------------------------------------------
123
136
// / Rewrite a single Objective-C constant string.
124
137
// /
125
- // / @param[in] M
138
+ // / @param[in] llvm_module
126
139
// / The module currently being processed.
127
140
// /
128
141
// / @param[in] NSStr
@@ -142,25 +155,27 @@ class IRForTarget : public llvm::ModulePass
142
155
// / @return
143
156
// / True on success; false otherwise
144
157
// ------------------------------------------------------------------
145
- bool rewriteObjCConstString (llvm::Module &M,
146
- llvm::GlobalVariable *NSStr,
147
- llvm::GlobalVariable *CStr,
148
- llvm::Instruction *FirstEntryInstruction);
158
+ bool
159
+ RewriteObjCConstString (llvm::Module &llvm_module,
160
+ llvm::GlobalVariable *NSStr,
161
+ llvm::GlobalVariable *CStr,
162
+ llvm::Instruction *FirstEntryInstruction);
149
163
150
164
// ------------------------------------------------------------------
151
165
// / The top-level pass implementation
152
166
// /
153
- // / @param[in] M
167
+ // / @param[in] llvm_module
154
168
// / The module currently being processed.
155
169
// /
156
- // / @param[in] F
170
+ // / @param[in] llvm_function
157
171
// / The function currently being processed.
158
172
// /
159
173
// / @return
160
174
// / True on success; false otherwise
161
175
// ------------------------------------------------------------------
162
- bool rewriteObjCConstStrings (llvm::Module &M,
163
- llvm::Function &F);
176
+ bool
177
+ RewriteObjCConstStrings (llvm::Module &llvm_module,
178
+ llvm::Function &llvm_function);
164
179
165
180
// ------------------------------------------------------------------
166
181
// / A basic block-level pass to find all Objective-C method calls and
@@ -179,29 +194,31 @@ class IRForTarget : public llvm::ModulePass
179
194
// / @param[in] selector_load
180
195
// / The load of the statically-allocated selector.
181
196
// /
182
- // / @param[in] M
197
+ // / @param[in] llvm_module
183
198
// / The module containing the load.
184
199
// /
185
200
// / @return
186
201
// / True on success; false otherwise
187
202
// ------------------------------------------------------------------
188
- bool RewriteObjCSelector (llvm::Instruction* selector_load,
189
- llvm::Module &M);
203
+ bool
204
+ RewriteObjCSelector (llvm::Instruction* selector_load,
205
+ llvm::Module &llvm_module);
190
206
191
207
// ------------------------------------------------------------------
192
208
// / The top-level pass implementation
193
209
// /
194
- // / @param[in] M
210
+ // / @param[in] llvm_module
195
211
// / The module currently being processed.
196
212
// /
197
- // / @param[in] BB
213
+ // / @param[in] basic_block
198
214
// / The basic block currently being processed.
199
215
// /
200
216
// / @return
201
217
// / True on success; false otherwise
202
218
// ------------------------------------------------------------------
203
- bool rewriteObjCSelectors (llvm::Module &M,
204
- llvm::BasicBlock &BB);
219
+ bool
220
+ RewriteObjCSelectors (llvm::Module &llvm_module,
221
+ llvm::BasicBlock &basic_block);
205
222
206
223
// ------------------------------------------------------------------
207
224
// / A basic block-level pass to find all newly-declared persistent
@@ -211,7 +228,7 @@ class IRForTarget : public llvm::ModulePass
211
228
// / variables look like normal locals, so they have an allocation.
212
229
// / This pass excises these allocations and makes references look
213
230
// / like external references where they will be resolved -- like all
214
- // / other external references -- by resolveExternals ().
231
+ // / other external references -- by ResolveExternals ().
215
232
// ------------------------------------------------------------------
216
233
217
234
// ------------------------------------------------------------------
@@ -220,26 +237,28 @@ class IRForTarget : public llvm::ModulePass
220
237
// / @param[in] persistent_alloc
221
238
// / The allocation of the persistent variable.
222
239
// /
223
- // / @param[in] M
240
+ // / @param[in] llvm_module
224
241
// / The module currently being processed.
225
242
// /
226
243
// / @return
227
244
// / True on success; false otherwise
228
245
// ------------------------------------------------------------------
229
- bool RewritePersistentAlloc (llvm::Instruction *persistent_alloc,
230
- llvm::Module &M);
246
+ bool
247
+ RewritePersistentAlloc (llvm::Instruction *persistent_alloc,
248
+ llvm::Module &llvm_module);
231
249
232
250
// ------------------------------------------------------------------
233
251
// / The top-level pass implementation
234
252
// /
235
- // / @param[in] M
253
+ // / @param[in] llvm_module
236
254
// / The module currently being processed.
237
255
// /
238
- // / @param[in] BB
256
+ // / @param[in] basic_block
239
257
// / The basic block currently being processed.
240
258
// ------------------------------------------------------------------
241
- bool rewritePersistentAllocs (llvm::Module &M,
242
- llvm::BasicBlock &BB);
259
+ bool
260
+ RewritePersistentAllocs (llvm::Module &llvm_module,
261
+ llvm::BasicBlock &basic_block);
243
262
244
263
// ------------------------------------------------------------------
245
264
// / A function-level pass to find all external variables and functions
@@ -252,7 +271,7 @@ class IRForTarget : public llvm::ModulePass
252
271
// ------------------------------------------------------------------
253
272
// / Handle a single externally-defined variable
254
273
// /
255
- // / @param[in] M
274
+ // / @param[in] llvm_module
256
275
// / The module currently being processed.
257
276
// /
258
277
// / @param[in] V
@@ -264,13 +283,14 @@ class IRForTarget : public llvm::ModulePass
264
283
// / @return
265
284
// / True on success; false otherwise
266
285
// ------------------------------------------------------------------
267
- bool MaybeHandleVariable (llvm::Module &M,
268
- llvm::Value *V);
286
+ bool
287
+ MaybeHandleVariable (llvm::Module &llvm_module,
288
+ llvm::Value *value);
269
289
270
290
// ------------------------------------------------------------------
271
291
// / Handle all the arguments to a function call
272
292
// /
273
- // / @param[in] M
293
+ // / @param[in] llvm_module
274
294
// / The module currently being processed.
275
295
// /
276
296
// / @param[in] C
@@ -279,13 +299,14 @@ class IRForTarget : public llvm::ModulePass
279
299
// / @return
280
300
// / True on success; false otherwise
281
301
// ------------------------------------------------------------------
282
- bool MaybeHandleCallArguments (llvm::Module &M,
283
- llvm::CallInst *C);
302
+ bool
303
+ MaybeHandleCallArguments (llvm::Module &llvm_module,
304
+ llvm::CallInst *call_inst);
284
305
285
306
// ------------------------------------------------------------------
286
307
// / Handle a single external function call
287
308
// /
288
- // / @param[in] M
309
+ // / @param[in] llvm_module
289
310
// / The module currently being processed.
290
311
// /
291
312
// / @param[in] C
@@ -294,38 +315,41 @@ class IRForTarget : public llvm::ModulePass
294
315
// / @return
295
316
// / True on success; false otherwise
296
317
// ------------------------------------------------------------------
297
- bool MaybeHandleCall (llvm::Module &M,
298
- llvm::CallInst *C);
318
+ bool
319
+ MaybeHandleCall (llvm::Module &llvm_module,
320
+ llvm::CallInst *C);
299
321
300
322
// ------------------------------------------------------------------
301
323
// / Resolve calls to external functions
302
324
// /
303
- // / @param[in] M
325
+ // / @param[in] llvm_module
304
326
// / The module currently being processed.
305
327
// /
306
- // / @param[in] BB
328
+ // / @param[in] basic_block
307
329
// / The basic block currently being processed.
308
330
// /
309
331
// / @return
310
332
// / True on success; false otherwise
311
333
// ------------------------------------------------------------------
312
- bool resolveCalls (llvm::Module &M,
313
- llvm::BasicBlock &BB);
334
+ bool
335
+ ResolveCalls (llvm::Module &llvm_module,
336
+ llvm::BasicBlock &basic_block);
314
337
315
338
// ------------------------------------------------------------------
316
339
// / The top-level pass implementation
317
340
// /
318
- // / @param[in] M
341
+ // / @param[in] llvm_module
319
342
// / The module currently being processed.
320
343
// /
321
- // / @param[in] BB
344
+ // / @param[in] basic_block
322
345
// / The function currently being processed.
323
346
// /
324
347
// / @return
325
348
// / True on success; false otherwise
326
349
// ------------------------------------------------------------------
327
- bool resolveExternals (llvm::Module &M,
328
- llvm::Function &F);
350
+ bool
351
+ ResolveExternals (llvm::Module &llvm_module,
352
+ llvm::Function &llvm_function);
329
353
330
354
// ------------------------------------------------------------------
331
355
// / A basic block-level pass to excise guard variables from the code.
@@ -337,17 +361,18 @@ class IRForTarget : public llvm::ModulePass
337
361
// ------------------------------------------------------------------
338
362
// / The top-level pass implementation
339
363
// /
340
- // / @param[in] M
364
+ // / @param[in] llvm_module
341
365
// / The module currently being processed.
342
366
// /
343
- // / @param[in] BB
367
+ // / @param[in] basic_block
344
368
// / The basic block currently being processed.
345
369
// /
346
370
// / @return
347
371
// / True on success; false otherwise
348
372
// ------------------------------------------------------------------
349
- bool removeGuards (llvm::Module &M,
350
- llvm::BasicBlock &BB);
373
+ bool
374
+ RemoveGuards (llvm::Module &llvm_module,
375
+ llvm::BasicBlock &basic_block);
351
376
352
377
// ------------------------------------------------------------------
353
378
// / A function-level pass to make all external variable references
@@ -359,21 +384,21 @@ class IRForTarget : public llvm::ModulePass
359
384
// ------------------------------------------------------------------
360
385
// / The top-level pass implementation
361
386
// /
362
- // / @param[in] M
387
+ // / @param[in] llvm_module
363
388
// / The module currently being processed.
364
389
// /
365
- // / @param[in] F
390
+ // / @param[in] llvm_function
366
391
// / The function currently being processed.
367
392
// /
368
393
// / @return
369
394
// / True on success; false otherwise
370
395
// ------------------------------------------------------------------
371
- bool replaceVariables (llvm::Module &M,
372
- llvm::Function &F);
396
+ bool
397
+ ReplaceVariables (llvm::Module &llvm_module,
398
+ llvm::Function &llvm_function);
373
399
374
400
// / Flags
375
401
bool m_resolve_vars; // /< True if external variable references and persistent variable references should be resolved
376
-
377
402
std::string m_func_name; // /< The name of the function to translate
378
403
lldb_private::ClangExpressionDeclMap *m_decl_map; // /< The DeclMap containing the Decls
379
404
llvm::Constant *m_CFStringCreateWithBytes; // /< The address of the function CFStringCreateWithBytes, cast to the appropriate function pointer type
@@ -394,18 +419,19 @@ class IRForTarget : public llvm::ModulePass
394
419
// / FirstEntryInstruction. These instructions replace the constant
395
420
// / uses, so UnfoldConstant calls itself recursively for those.
396
421
// /
397
- // / @param[in] M
422
+ // / @param[in] llvm_module
398
423
// / The module currently being processed.
399
424
// /
400
- // / @param[in] F
425
+ // / @param[in] llvm_function
401
426
// / The function currently being processed.
402
427
// /
403
428
// / @return
404
429
// / True on success; false otherwise
405
430
// ------------------------------------------------------------------
406
- static bool UnfoldConstant (llvm::Constant *Old,
407
- llvm::Value *New,
408
- llvm::Instruction *FirstEntryInstruction);
431
+ static bool
432
+ UnfoldConstant (llvm::Constant *old_constant,
433
+ llvm::Value *new_constant,
434
+ llvm::Instruction *first_entry_inst);
409
435
};
410
436
411
437
#endif
0 commit comments