[clang] Reland: [clang] Diagnose dangling issues for the "Container<GSLPointer>" case. #107213 (PR #108344)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 23 05:22:32 PDT 2024


================
@@ -285,6 +285,18 @@ static bool isContainerOfPointer(const RecordDecl *Container) {
   }
   return false;
 }
+static bool isContainerOfOwner(const RecordDecl *Container) {
+  if (const auto *CTSD =
+          dyn_cast_if_present<ClassTemplateSpecializationDecl>(Container)) {
----------------
usx95 wrote:

nit: use early return to reduce nesting.
```
const auto *CTSD =
          dyn_cast_if_present<ClassTemplateSpecializationDecl>(Container);
if (!CTSD) return;
```

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


More information about the cfe-commits mailing list