| 1 | #ifndef LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_LIFETIMEMODELING_H |
|---|---|
| 2 | #define LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_LIFETIMEMODELING_H |
| 3 | |
| 4 | #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h" |
| 5 | #include "clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h" |
| 6 | #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h" |
| 7 | #include <vector> |
| 8 | |
| 9 | namespace clang::ento::lifetime_modeling { |
| 10 | /// Returns the set of lifetime sources bound to \p Source that are dangling |
| 11 | /// stack regions. |
| 12 | std::vector<const MemRegion *> |
| 13 | getDanglingRegionsAfterReturn(SVal Source, ProgramStateRef State, |
| 14 | CheckerContext &C); |
| 15 | |
| 16 | /// Returns true if the underlying MemRegion is deallocated. |
| 17 | bool isDeallocated(ProgramStateRef State, const MemRegion *Region); |
| 18 | |
| 19 | /// Returns true if \p Val is a key in the LifetimeBoundMap. |
| 20 | bool isBoundToLifetimeSource(ProgramStateRef State, SVal Val); |
| 21 | |
| 22 | /// Returns the descriptive name of the memory region or a placeholder if a |
| 23 | /// descriptive name cannot be constructed for it. |
| 24 | std::string getRegionName(const MemRegion *Reg); |
| 25 | |
| 26 | /// Returns the updated \p State with \p R marked as reported if \p R is seen |
| 27 | /// the first time. Returns nullptr if \p R was already reported. |
| 28 | ProgramStateRef markAsReported(ProgramStateRef State, const MemRegion *Region); |
| 29 | |
| 30 | } // namespace clang::ento::lifetime_modeling |
| 31 | |
| 32 | #endif // LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_LIFETIMEMODELING_H |
| 33 |