[all-commits] [llvm/llvm-project] 33cd00: [flang] Use more generic overload for Operation in...

Krzysztof Parzyszek via All-commits all-commits at lists.llvm.org
Fri Mar 28 06:17:53 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 33cd00f8c82d5df45b1dfd59310929a4d315fd8e
      https://github.com/llvm/llvm-project/commit/33cd00f8c82d5df45b1dfd59310929a4d315fd8e
  Author: Krzysztof Parzyszek <Krzysztof.Parzyszek at amd.com>
  Date:   2025-03-28 (Fri, 28 Mar 2025)

  Changed paths:
    M flang/include/flang/Evaluate/traverse.h

  Log Message:
  -----------
  [flang] Use more generic overload for Operation in Traverse (#133305)

Currently there are two specific overloads: for unary operations, i.e.
`Operation<D, R, O>`, and binary ones `Operation<D, R, LO, RO>`.

This makes it impossible for a derived class to use a single overload to
handle all types of operations: `Operation<D, R, O...>`. Since the base
overloads need to be included in the derived class's scope, via `using
Base::operator()` either one of the specific overloads will always be a
better candidate than the more generic derived one.

```
class MyVisitor : public Traverse<...> {
  using Traverse<...>::operator();

  template <typename D, typename R, typename... O>
  Result operator()(const Operation<D, R, O...> &op) const {
    // Will never be used.
  }
};
```
This patch replaces the two specific overloads for Operation in Traverse
with a single generic overload, while preserving the existing
functionality, and allowing derived classes to use a single overload as
well.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list