[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 29 11:31:44 PDT 2019


xazax.hun added inline comments.


================
Comment at: clang/lib/Sema/SemaInit.cpp:7095
       auto *MTE = dyn_cast<MaterializeTemporaryExpr>(L);
+      if (IsGslPtrInitWithGslTempOwner) {
+        Diag(DiagLoc, diag::warn_dangling_lifetime_pointer) << DiagRange;
----------------
gribozavr wrote:
> It is unclear to me why `if (IsGslPtrInitWithGslTempOwner)` is before `if (!MTE)`, seems like that exclusion should apply to our case, too.
The reason was that I always skipped MTEs and was looking for the expr that actually initialized MTEs. Relying on MTEs, however, turned out to simplify the code a bit. Updating the diff, thanks!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64256/new/

https://reviews.llvm.org/D64256





More information about the cfe-commits mailing list