[all-commits] [llvm/llvm-project] d40877: [Passes] Use llvm::any_cast instead of any_cast (NFC)

Kazu Hirata via All-commits all-commits at lists.llvm.org
Sat Sep 30 00:02:25 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d408770c007896d84c3e8d80351bc0d4aeb4e229
      https://github.com/llvm/llvm-project/commit/d408770c007896d84c3e8d80351bc0d4aeb4e229
  Author: Kazu Hirata <kazu at google.com>
  Date:   2023-09-30 (Sat, 30 Sep 2023)

  Changed paths:
    M llvm/lib/Passes/StandardInstrumentations.cpp

  Log Message:
  -----------
  [Passes] Use llvm::any_cast instead of any_cast (NFC)

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