[PATCH] D86736: [analyzer][NFC] Don't bind values to ObjCForCollectionStmt, replace it with a GDM trait

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 5 17:38:21 PDT 2020


NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

This looks correct to me. Thanks a lot. This hack was surprisingly crude and i'm very glad that we now consistently use expressions in our Environment.



================
Comment at: clang/lib/StaticAnalyzer/Core/ProgramState.cpp:329
+
+REGISTER_MAP_WITH_PROGRAMSTATE(ObjCForHasMoreIterations, ObjCForLctxPair, bool)
+
----------------
I'd really prefer this to live in `ExprEngine.cpp`, like C++ constructor traits, and not be exposed in the `ProgramState` API, because as of now this is an implementation hack that other clients of `ProgramState` don't beed to know about.

The actual non-placeholder implementation would i guess be interesting. The loop boils down to repeatedly sending certain messages to the collection. So i guess we could `evalCall` them in the checker that'll deal with modeling these collections.


================
Comment at: clang/lib/StaticAnalyzer/Core/SymbolManager.cpp:498
 
-  // If no statement is provided, everything is this and parent contexts is live.
+  // If no statement is provided, everything in this and parent contexts are
+  // live.
----------------
IIRC "everything is" is the valid English.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86736/new/

https://reviews.llvm.org/D86736



More information about the cfe-commits mailing list