[clang] [clang][dataflow] Refactor `PropagateResultObject()` with a switch statement. (PR #88865)

via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 16 05:42:13 PDT 2024


martinboehme wrote:

> Clearly, this is a matter of taste, so I would defer to your opinion, since you are the primary maintainer of this code. But, personally, I prefer this style since it makes clear that the body of the function is a single case analysis, which is not obvious from the series of if statements. It's unfortunate that the enum syntax is so bulky (the need for `Stmt::` and the `Class` suffix). The casts don't bother me (well, any more than C++'s general lack of built-in datatype and pattern matching support bother me :)).

I think maybe I'm coming round to your point of view (or, at least, I no longer clearly believe that the existing version is better).

I'm making this a non-draft PR and will add @Xazax-hun for an additional opinion. I have some other PRs in flight though that also touch `PropagateResultObject()`, and my plan is to land those first. In the meantime, I think the direction of this PR is clear though, so I think it makes sense to review.

https://github.com/llvm/llvm-project/pull/88865


More information about the cfe-commits mailing list