================
@@ -346,6 +352,39 @@ class CompoundVal : public NonLoc {
   static bool classof(SVal V) { return V.getKind() == CompoundValKind; }
 };
 
+/// The simplest example of a concrete compound value is nonloc::CompoundVal,
+/// which represents a concrete r-value of an initializer-list or a string.
+/// Internally, it contains an llvm::ImmutableList of SVal's stored inside the
+/// literal.
+///
+/// However, there is another compound value used in the analyzer, which 
appears
+/// much more often during analysis, which is nonloc::LazyCompoundVal. This
+/// value is an r-value that represents a snapshot of any structure "as a 
whole"
+/// at a given moment during the analysis. Such value is already quite far from
+/// being re- ferred to as "concrete", as many fields inside it would be 
unknown
+/// or symbolic. nonloc::LazyCompoundVal operates by storing two things:
+///   * a reference to the TypedValueRegion being snapshotted (yes, it is 
always
+///     typed), and also
+///   * a copy of the whole Store object, obtained from the ProgramState in
----------------
NagyDonat wrote:

I do understand functional programming (I had a phase when I learnt Haskell and 
for a few years I thought that it's the absolutely perfect language 
:star_struck: -- since then I'm more realistic but I still like it), I was just 
confused by the fact that this line emphasizes "a copy of the whole Store 
object" as opposed to the "reference to" in the previous line.

In a functional language the word "copy" is practically non-existent (we speak 
about values, not objects and their identity, so there is no reason to say that 
this is _a copy of_ e.g. that list -- we simply say that "this is that list"), 
while in C++ saying "copy" instead of "move" or "pointer/reference" is an 
important synonym of "we allocate lots of new memory", so I'd still prefer 
tweaking this line.

https://github.com/llvm/llvm-project/pull/97407
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to