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

Sebastian Neubauer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 13 14:53:00 PST 2022


sebastian-ne created this revision.
sebastian-ne added reviewers: jloser, MaskRay, dblaikie, jsilvanus.
Herald added subscribers: ormris, StephenFan, wenlei, hiraditya.
Herald added a project: All.
sebastian-ne requested review of this revision.
Herald added projects: clang, LLDB, LLVM.
Herald added subscribers: llvm-commits, lldb-commits, cfe-commits.

This facilitates replacing llvm::Any with std::any.

- Deprecate any_isa in favor of using any_cast(Any*) and checking for nullptr because C++17 has no any_isa.
- Remove the assert from any_cast(Any*), so it returns nullptr if the type is not correct. This aligns it with std::any_cast(any*).

Use any_cast(Any*) throughout LLVM instead of checks with any_isa.

This is the first part outlined in
https://discourse.llvm.org/t/rfc-switching-from-llvm-any-to-std-any/67176


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D139973

Files:
  clang/unittests/Tooling/RefactoringTest.cpp
  clang/unittests/Tooling/TransformerTest.cpp
  lldb/include/lldb/Core/RichManglingContext.h
  llvm/include/llvm/ADT/Any.h
  llvm/lib/CodeGen/MachinePassManager.cpp
  llvm/lib/IR/LLVMContextImpl.h
  llvm/lib/Passes/StandardInstrumentations.cpp
  llvm/lib/Transforms/IPO/SampleProfileProbe.cpp
  llvm/lib/Transforms/Scalar/LoopPassManager.cpp
  llvm/lib/Transforms/Utils/Debugify.cpp
  llvm/unittests/ADT/AnyTest.cpp
  llvm/unittests/IR/PassBuilderCallbacksTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139973.482635.patch
Type: text/x-patch
Size: 26147 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221213/1cd939d5/attachment.bin>


More information about the llvm-commits mailing list