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

Matthias Gehre via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 23 12:38:09 PDT 2019


mgehre added a comment.

When I understand you correctly, you are thinking about
the cases

  OwningArrayRef getRef();
  
  ArrayRef f() {
    ArrayRef r = getRef(); // warning: r points into temporary owner
    return r;
  }

and

  ArrayRef getRef() {
    OwningArrayRef r;
    return r;  // warning: returning reference to local variable
  }

which we will both diagnose correctly with the current analysis. In which case would our analysis have problems with the fact that ArrayRef is a Pointer and the derived OwningArrayRef is a Owner?


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