[clang] [LifetimeSafety] Model bit_cast and atomic casts in the fact generator (PR #204591)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 18 19:07:53 PDT 2026


================
@@ -101,6 +101,10 @@ class LifetimeAnnotatedOriginTypeCollector
 } // namespace
 
 bool OriginManager::hasOrigins(QualType QT, bool IntrinsicOnly) const {
+  // An `_Atomic(T)` wraps T transparently for lifetime purposes (the atomic
+  // holds the same value); see through it.
+  if (const auto *AT = QT->getAs<AtomicType>())
+    return hasOrigins(AT->getValueType(), IntrinsicOnly);
----------------
NeKon69 wrote:

Should this instead be put after the reference/pointer checks? I feel like that would be much rarer that someone uses atomic than pointer/reference.

https://github.com/llvm/llvm-project/pull/204591


More information about the cfe-commits mailing list