[all-commits] [llvm/llvm-project] b96c24: [analyzer] Allow copying empty structs (1/4) (#115...

Balazs Benics via All-commits all-commits at lists.llvm.org
Thu Nov 14 05:31:55 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b96c24b8613036749e7ba28f0c7a837115ae9f91
      https://github.com/llvm/llvm-project/commit/b96c24b8613036749e7ba28f0c7a837115ae9f91
  Author: Balazs Benics <benicsbalazs at gmail.com>
  Date:   2024-11-14 (Thu, 14 Nov 2024)

  Changed paths:
    M clang/lib/StaticAnalyzer/Core/RegionStore.cpp
    M clang/test/Analysis/ctor-trivial-copy.cpp

  Log Message:
  -----------
  [analyzer] Allow copying empty structs (1/4) (#115916)

We represent copies of structs by LazyCompoundVals, that is basically a
snapshot of the Store and Region that your copy would refer to.

This snapshot is actually not taken for empty structs (structs that have
no non-static data members), because the users won't be able to access
any fields anyways, so why bother.
However, when it comes to taint propagation, it would be nice if
instances of empty structs would behave similar to non-empty structs.
For this, we need an identity for which taint can bind, so Unknown -
that was used in the past wouldn't work.

Consequently, copying the value of an empty struct should behave the
same way as a non-empty struct, thus be represented by a
LazyCompoundVal.

Split from #114835



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list