27
27
#include " clang/Analysis/FlowSensitive/Value.h"
28
28
#include " llvm/ADT/DenseMap.h"
29
29
#include " llvm/ADT/DenseSet.h"
30
+ #include " llvm/Support/Compiler.h"
30
31
#include " llvm/Support/ErrorHandling.h"
31
32
#include < memory>
32
33
#include < type_traits>
@@ -178,12 +179,16 @@ class Environment {
178
179
// / with a symbolic representation of the `this` pointee.
179
180
Environment (DataflowAnalysisContext &DACtx, const DeclContext &DeclCtx);
180
181
182
+ LLVM_DEPRECATED (" Use getDataflowAnalysisContext().getOptions() instead." , " " )
181
183
const DataflowAnalysisContext::Options &getAnalysisOptions () const {
182
184
return DACtx->getOptions ();
183
185
}
184
186
187
+ LLVM_DEPRECATED (" Use getDataflowAnalysisContext().arena() instead." , " " )
185
188
Arena &arena () const { return DACtx->arena (); }
186
189
190
+ LLVM_DEPRECATED (" Use getDataflowAnalysisContext().getOptions().Log instead." ,
191
+ " " )
187
192
Logger &logger () const { return *DACtx->getOptions ().Log ; }
188
193
189
194
// / Creates and returns an environment to use for an inline analysis of the
@@ -331,61 +336,61 @@ class Environment {
331
336
template <typename T, typename ... Args>
332
337
std::enable_if_t <std::is_base_of<Value, T>::value, T &>
333
338
create (Args &&...args) {
334
- return arena ().create <T>(std::forward<Args>(args)...);
339
+ return DACtx-> arena ().create <T>(std::forward<Args>(args)...);
335
340
}
336
341
337
342
// / Returns a symbolic boolean value that models a boolean literal equal to
338
343
// / `Value`
339
344
AtomicBoolValue &getBoolLiteralValue (bool Value) const {
340
- return arena ().makeLiteral (Value);
345
+ return DACtx-> arena ().makeLiteral (Value);
341
346
}
342
347
343
348
// / Returns an atomic boolean value.
344
349
BoolValue &makeAtomicBoolValue () const {
345
- return arena ().create <AtomicBoolValue>();
350
+ return DACtx-> arena ().create <AtomicBoolValue>();
346
351
}
347
352
348
353
// / Returns a unique instance of boolean Top.
349
354
BoolValue &makeTopBoolValue () const {
350
- return arena ().create <TopBoolValue>();
355
+ return DACtx-> arena ().create <TopBoolValue>();
351
356
}
352
357
353
358
// / Returns a boolean value that represents the conjunction of `LHS` and
354
359
// / `RHS`. Subsequent calls with the same arguments, regardless of their
355
360
// / order, will return the same result. If the given boolean values represent
356
361
// / the same value, the result will be the value itself.
357
362
BoolValue &makeAnd (BoolValue &LHS, BoolValue &RHS) const {
358
- return arena ().makeAnd (LHS, RHS);
363
+ return DACtx-> arena ().makeAnd (LHS, RHS);
359
364
}
360
365
361
366
// / Returns a boolean value that represents the disjunction of `LHS` and
362
367
// / `RHS`. Subsequent calls with the same arguments, regardless of their
363
368
// / order, will return the same result. If the given boolean values represent
364
369
// / the same value, the result will be the value itself.
365
370
BoolValue &makeOr (BoolValue &LHS, BoolValue &RHS) const {
366
- return arena ().makeOr (LHS, RHS);
371
+ return DACtx-> arena ().makeOr (LHS, RHS);
367
372
}
368
373
369
374
// / Returns a boolean value that represents the negation of `Val`. Subsequent
370
375
// / calls with the same argument will return the same result.
371
376
BoolValue &makeNot (BoolValue &Val) const {
372
- return arena ().makeNot (Val);
377
+ return DACtx-> arena ().makeNot (Val);
373
378
}
374
379
375
380
// / Returns a boolean value represents `LHS` => `RHS`. Subsequent calls with
376
381
// / the same arguments, will return the same result. If the given boolean
377
382
// / values represent the same value, the result will be a value that
378
383
// / represents the true boolean literal.
379
384
BoolValue &makeImplication (BoolValue &LHS, BoolValue &RHS) const {
380
- return arena ().makeImplies (LHS, RHS);
385
+ return DACtx-> arena ().makeImplies (LHS, RHS);
381
386
}
382
387
383
388
// / Returns a boolean value represents `LHS` <=> `RHS`. Subsequent calls with
384
389
// / the same arguments, regardless of their order, will return the same
385
390
// / result. If the given boolean values represent the same value, the result
386
391
// / will be a value that represents the true boolean literal.
387
392
BoolValue &makeIff (BoolValue &LHS, BoolValue &RHS) const {
388
- return arena ().makeEquals (LHS, RHS);
393
+ return DACtx-> arena ().makeEquals (LHS, RHS);
389
394
}
390
395
391
396
// / Returns the token that identifies the flow condition of the environment.
@@ -409,10 +414,15 @@ class Environment {
409
414
410
415
// / Returns the `ControlFlowContext` registered for `F`, if any. Otherwise,
411
416
// / returns null.
417
+ LLVM_DEPRECATED (
418
+ " Use getDataflowAnalysisContext().getControlFlowContext(F) instead." , " " )
412
419
const ControlFlowContext *getControlFlowContext (const FunctionDecl *F) {
413
420
return DACtx->getControlFlowContext (F);
414
421
}
415
422
423
+ // / Returns the `DataflowAnalysisContext` used by the environment.
424
+ DataflowAnalysisContext &getDataflowAnalysisContext () const { return *DACtx; }
425
+
416
426
LLVM_DUMP_METHOD void dump () const ;
417
427
LLVM_DUMP_METHOD void dump (raw_ostream &OS) const ;
418
428
0 commit comments