[PATCH] D33672: [analyzer] INT50-CPP. Do not cast to an out-of-range enumeration checker

Umann Kristóf via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 29 14:08:36 PDT 2018


Szelethus added inline comments.


================
Comment at: lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp:36
+  const ProgramStateRef PS;
+  SValBuilder &SVB;
+
----------------
NoQ wrote:
> ZaMaZaN4iK wrote:
> > Szelethus wrote:
> > > You can acquire `SValBuilder` from `ProgramState`:
> > > `PS->getStateManager()->getSvalBuilder()`
> > Is there any difference? Is it critical to get `SValBuilder` from `CheckerContext' ?
> There's only one instance of `SValBuilder` in existence at any particular moment of time. The same applies to `BasicValueFactory`, `SymbolManager`, `MemRegionManager`, `ConstraintManager`, `StoreManager`, `ProgramStateManager`, ...
> 
> All these objects live within `ExprEngine` and have the same lifetime.
> 
> `ExprEngine`, together with all these objects, is created from scratch for every analysis of a top-level function.
> 
> AST entities, such ast `ASTContex`, on the contrary, live much longer - only one is created per clang process. That is, until somebody takes `ASTImporter` and tries to frankenstein multiple ASTs into one :)
Then I guess no, it's not critical. ^-^


https://reviews.llvm.org/D33672





More information about the cfe-commits mailing list