[PATCH] D156261: [NFC] Cast unchecked return values to void.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 26 06:39:59 PDT 2023


aaron.ballman added a comment.

I think the cast to void is unneeded in these cases. We typically add a cast to void when the function exists to compute a result but also has side effects. e.g., you typically call `malloc()` because you want the returned pointer, but if for some reason you don't want the pointer but still want the side effect of the memory allocation, you'd cast the result of the call to `void`. In this case, the `Traverse` functions exist mostly to perform side effects and the return value is only used to indicate "should we keep going?". It's reasonable to ignore the return value in this case if you don't intend to stop the traversal (and in this particular case, nothing will return `false` from the traversal and so there's really no need to check the return values here).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156261



More information about the cfe-commits mailing list