[PATCH] D16403: Add scope information to CFG

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 30 14:09:45 PST 2018


NoQ added a comment.

Thank you, this explanation looks very reasonable.

All right, so right after the termination of the loop we have

  [B1]
  1: ForStmt (LoopExit)
  2: [B4.5].~A() (Implicit destructor)
  3: [B5.3].~A() (Implicit destructor)
  4: CFGScopeEnd(a)
  5: CFGScopeEnd(b)

... where `[B4.5]` is `A b = a;` and `[B5.3]` is `A a;`. Am i understanding correctly that while destroying `a` you can still use the storage of `b` safely? Or should `a` go out of scope before `b` gets destroyed? Also, is the order of scope ends actually correct here - shouldn't `b` go out of scope earlier? Given that they are in very different lifetime scopes (`a` is one for the whole loop, `b` is per-loop-iteration). I guess the order would matter for the analyzer.


Repository:
  rL LLVM

https://reviews.llvm.org/D16403





More information about the cfe-commits mailing list