benedekaibas wrote:

I had another implementation before the one I have in this PR:

When I looked at the issue I could see that the problem is that the two 
functions don't iterate over the same vector. For that I have implemented a 
helper function that iterates over all the `VarDecl`s in reverse order in the 
range and provides that vector for both functions. This actually resolved the 
issue, but I started seeing duplicate elements in the CFG:

```  
  10: [B1.9] (Lifetime ends)
  11: [B1.7].~NonTrivial() (Implicit destructor)
  12: [B1.7] (Lifetime ends)
  13: [B1.5] (Lifetime ends)
  14: [B1.3].~NonTrivial() (Implicit destructor)
  15: [B1.3] (Lifetime ends)
  16: [B1.9] (Lifetime ends)
  17: [B1.7] (Lifetime ends)
  18: [B1.5] (Lifetime ends)
  19: [B1.3] (Lifetime ends)
```

This was the point where I figured out that `addScopeExitHandling` does not 
need to call `appendLifetimeEnds` and therefore the helper function is not 
needed either. 

https://github.com/llvm/llvm-project/pull/243630
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to