[PATCH] D139973: [llvm] Make llvm::Any similar to std::any

Sergei Barannikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 19 02:18:39 PST 2022


barannikov88 added a comment.

Just thoughts.

llvm::any_isa is usually paired with llvm::any_cast; replacing them with llvm::any_cast and nullptr check seems fine.
However,

- std::any uses RTTI, so it is unlikely to ever replace llvm::Any.
- llvm::any_isa<> is kind of convenient and is aligned with llvm::isa<>. Same for llvm::any_cast.
- With that in mind, introducing new llvm::any_cast_or_null to follow llvm::cast_or_null instead of changing the semantics of llvm::any_cast might be a better idea.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139973



More information about the llvm-commits mailing list