rjmccall added a comment.

> We need to check the scopes like we would for direct goto, because we don't 
> want to bypass non-trivial destructors.

I think this is the basic misunderstanding here.  Direct `goto` is allowed to 
jump out of scopes; it just runs destructors on the way.  It is only a direct 
branch to the target block if there are no destructors along the path.

Indirect `goto` is not allowed to jump out of scopes because, in general, the 
labels could be in different scopes with different sets of destructors 
required, and so the only way we could run the right set of destructors along 
the way would be to dynamically compare the label value with specific labels, 
which would defeat the point of the feature.  (This is unnecessary if all the 
labels are in the same scope, which is typical, but nobody has felt like 
extending the feature to recognize that pattern and be more general.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155342

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to