[clang] [LifetimeSafety] Add origin tracking for lambda captures (PR #185216)

Zhijie Wang via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 8 19:14:17 PDT 2026


================
@@ -51,7 +51,19 @@ class MissingOriginCollector
 } // namespace
 
 bool hasOrigins(QualType QT) {
-  return QT->isPointerOrReferenceType() || isGslPointerType(QT);
+  if (QT->isPointerOrReferenceType() || isGslPointerType(QT))
+    return true;
+  const auto *RD = QT->getAsCXXRecordDecl();
----------------
aeft wrote:

Redundant `getAsCXXRecordDecl()` call here (also inside `isGslPointerType`). Should I refactor this to avoid the double lookup, or is the current duplication acceptable for now? Happy to add a TODO if we want to refactor later.

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


More information about the cfe-commits mailing list