[PATCH] D127742: [analyzer][NFC] Prefer using isa<> instead getAs<> in conditions

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 15 00:48:05 PDT 2022


martong accepted this revision.
martong added a comment.
This revision is now accepted and ready to land.

In D127742#3582236 <https://reviews.llvm.org/D127742#3582236>, @steakhal wrote:

> In D127742#3581874 <https://reviews.llvm.org/D127742#3581874>, @martong wrote:
>
>> Why not replace all `getAs`?
>
> That's a massive change. I actually experimented with it and I see no advantage with that.
>
>> I suppose you picked conditions because `isa` can have variadic parameters. If we are about to keep `getAs` then why not replace only those occurrences where we see the benefit of the variadic `isa`?
>
> I believe it reads more naturally. `getAs<>` should be used only if we care about the value and don't know if it has one.

Ok, makes sense. LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127742



More information about the cfe-commits mailing list