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

Balazs Benics via All-commits all-commits at lists.llvm.org
Wed Oct 1 08:10:48 PDT 2025


  Branch: refs/heads/release/21.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 0060034c6a0b3735c3f7fd89173884a10fe30206
      https://github.com/llvm/llvm-project/commit/0060034c6a0b3735c3f7fd89173884a10fe30206
  Author: Balazs Benics <benicsbalazs at gmail.com>
  Date:   2025-10-01 (Wed, 01 Oct 2025)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    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

(cherry picked from commit 38b948bd4b9bd0ed532c3bea69e0038b3dffe80a)



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