[all-commits] [llvm/llvm-project] f8a1c8: [llvm] Use llvm::any_cast instead of any_cast (NFC...

kazutakahirata via All-commits all-commits at lists.llvm.org
Thu Sep 7 09:07:54 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f8a1c8b7c1d06a74fa38111454c42e22e118d584
      https://github.com/llvm/llvm-project/commit/f8a1c8b7c1d06a74fa38111454c42e22e118d584
  Author: kazutakahirata <57370056+kazutakahirata at users.noreply.github.com>
  Date:   2023-09-07 (Thu, 07 Sep 2023)

  Changed paths:
    M llvm/lib/CodeGen/MachinePassManager.cpp
    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] Use llvm::any_cast instead of any_cast (NFC) (#65565)

This patch replaces any_cast with llvm::any_cast. This in turn allows us
to gracefully switch to std::any in future by forwarding llvm::Any and
llvm::any_cast to:

  using Any = std::any;

  template <class T> T *any_cast(Any *Value) {
    return std::any_cast<T>(Value);
  }

respectively.

Without this patch, it's ambiguous whether any_cast refers to
std::any_cast or llvm::any_cast.

As an added bonus, this patch makes it easier to mechanically replace
llvm::any_cast with std::any_cast without affecting other occurrences of
any_cast (e.g. in libcxx).




More information about the All-commits mailing list