diff options
Diffstat (limited to 'include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h')
-rw-r--r-- | include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h b/include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h index c63ed4a013aa..d49aa81bc958 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h @@ -1,4 +1,4 @@ -//== Environment.h - Map from Stmt* to Locations/Values ---------*- C++ -*--==// +//===- Environment.h - Map from Stmt* to Locations/Values -------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -15,16 +15,17 @@ #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_ENVIRONMENT_H #include "clang/Analysis/AnalysisDeclContext.h" +#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h" #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h" #include "llvm/ADT/ImmutableMap.h" +#include <utility> namespace clang { -class LiveVariables; +class Stmt; namespace ento { -class EnvironmentManager; class SValBuilder; class SymbolReaper; @@ -32,7 +33,7 @@ class SymbolReaper; /// This allows the environment to manage context-sensitive bindings, /// which is essentially for modeling recursive function analysis, among /// other things. -class EnvironmentEntry : public std::pair<const Stmt*, +class EnvironmentEntry : public std::pair<const Stmt *, const StackFrameContext *> { public: EnvironmentEntry(const Stmt *s, const LocationContext *L); @@ -57,19 +58,17 @@ class Environment { private: friend class EnvironmentManager; - // Type definitions. - typedef llvm::ImmutableMap<EnvironmentEntry, SVal> BindingsTy; + using BindingsTy = llvm::ImmutableMap<EnvironmentEntry, SVal>; - // Data. BindingsTy ExprBindings; - Environment(BindingsTy eb) - : ExprBindings(eb) {} + Environment(BindingsTy eb) : ExprBindings(eb) {} SVal lookupExpr(const EnvironmentEntry &E) const; public: - typedef BindingsTy::iterator iterator; + using iterator = BindingsTy::iterator; + iterator begin() const { return ExprBindings.begin(); } iterator end() const { return ExprBindings.end(); } @@ -92,21 +91,19 @@ public: bool operator==(const Environment& RHS) const { return ExprBindings == RHS.ExprBindings; } - - void print(raw_ostream &Out, const char *NL, const char *Sep) const; - -private: - void printAux(raw_ostream &Out, bool printLocations, - const char *NL, const char *Sep) const; + + void print(raw_ostream &Out, const char *NL, const char *Sep, + const LocationContext *WithLC = nullptr) const; }; class EnvironmentManager { private: - typedef Environment::BindingsTy::Factory FactoryTy; + using FactoryTy = Environment::BindingsTy::Factory; + FactoryTy F; public: - EnvironmentManager(llvm::BumpPtrAllocator& Allocator) : F(Allocator) {} + EnvironmentManager(llvm::BumpPtrAllocator &Allocator) : F(Allocator) {} Environment getInitialEnvironment() { return Environment(F.getEmptyMap()); @@ -121,8 +118,8 @@ public: ProgramStateRef state); }; -} // end GR namespace +} // namespace ento -} // end clang namespace +} // namespace clang -#endif +#endif // LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_ENVIRONMENT_H |