[all-commits] [llvm/llvm-project] bb7940: [llvm] Make llvm::Any similar to std::any

Sebastian Neubauer via All-commits all-commits at lists.llvm.org
Tue Dec 20 04:31:51 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bb7940e25f6ca201ca57943544016390f1d2e504
      https://github.com/llvm/llvm-project/commit/bb7940e25f6ca201ca57943544016390f1d2e504
  Author: Sebastian Neubauer <Sebastian.Neubauer at amd.com>
  Date:   2022-12-20 (Tue, 20 Dec 2022)

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

  Log Message:
  -----------
  [llvm] Make llvm::Any similar to std::any

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

Differential Revision: https://reviews.llvm.org/D139973




More information about the All-commits mailing list