[PATCH] D66486: [LifetimeAnalysis] Detect more cases when the address of a local variable escapes

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 21 02:14:56 PDT 2019


gribozavr added inline comments.


================
Comment at: clang/lib/Sema/SemaInit.cpp:6775
+    if (!pathOnlyInitializesGslPointer(Path))
+      Init = const_cast<Expr *>(Init->skipRValueSubobjectAdjustments());
 
----------------
I'm afraid this change could disable some other analysis, which would hide other lifetime issues. For example, while 'ptr' can't itself dangle, if 'Temp().ptr' is bound to a local reference, it might be subject to complex lifetime extension rules, which this warning originally tried to check for.


================
Comment at: clang/lib/Sema/SemaInit.cpp:6897
+    if (!pathOnlyInitializesGslPointer(Path))
+      Init = const_cast<Expr *>(Init->skipRValueSubobjectAdjustments());
 
----------------
Same here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66486





More information about the cfe-commits mailing list