[all-commits] [llvm/llvm-project] 38b948: [analyzer] Revert #115918, so empty base class opt...

Balazs Benics via All-commits all-commits at lists.llvm.org
Thu Sep 11 07:49:16 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 38b948bd4b9bd0ed532c3bea69e0038b3dffe80a
      https://github.com/llvm/llvm-project/commit/38b948bd4b9bd0ed532c3bea69e0038b3dffe80a
  Author: Balazs Benics <benicsbalazs at gmail.com>
  Date:   2025-09-11 (Thu, 11 Sep 2025)

  Changed paths:
    M clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
    M clang/test/Analysis/ctor-trivial-copy.cpp
    A clang/test/Analysis/issue-157467.cpp
    M clang/test/Analysis/taint-generic.cpp

  Log Message:
  -----------
  [analyzer] Revert #115918, so empty base class optimization works again (#157480)

Tldr;
We can't unconditionally trivially copy empty classes because that would
clobber the stored entries in the object that the optimized empty class
overlaps with.

This regression was introduced by #115918, which introduced other
clobbering issues, like the handling of `[[no_unique_address]]` fields
in #137252.

Read issue #157467 for the detailed explanation, but in short, I'd
propose reverting the original patch because these was a lot of problems
with it for arguably not much gain.
In particular, that patch was motivated by unifying the handling of
classes so that copy events would be triggered for a class no matter if
it had data members or not.
So in hindsight, it was not worth it.

I plan to backport this to clang-21 as well, and mention in the release
notes that this should fix the regression from clang-20.

PS: Also an interesting read [D43714](https://reviews.llvm.org/D43714)
in hindsight.

Fixes #157467
CPP-6574



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