[llvm-branch-commits] [clang] [LifetimeSafety] Detect use-after-invalidation for STL containers (PR #179093)

Gábor Horváth via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Feb 3 02:48:58 PST 2026


================
@@ -255,4 +255,76 @@ template <typename T> static bool isRecordWithAttr(QualType Type) {
 bool isGslPointerType(QualType QT) { return isRecordWithAttr<PointerAttr>(QT); }
 bool isGslOwnerType(QualType QT) { return isRecordWithAttr<OwnerAttr>(QT); }
 
+bool isContainerInvalidationMethod(const CXXMethodDecl *MD) {
+  if (!MD)
+    return false;
+  const CXXRecordDecl *RD = MD->getParent();
+  if (!RD || !isInStlNamespace(RD))
----------------
Xazax-hun wrote:

In what cases would a `CXXRecordDecl` not have a parent?

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


More information about the llvm-branch-commits mailing list