[all-commits] [llvm/llvm-project] 43f6e0: Make `mlir::OpState::operator bool` explicit

Mehdi Amini via All-commits all-commits at lists.llvm.org
Mon May 17 10:29:50 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 43f6e04258aaece5b45c18986e0e6c3e690fa82e
      https://github.com/llvm/llvm-project/commit/43f6e04258aaece5b45c18986e0e6c3e690fa82e
  Author: Mehdi Amini <joker.eph at gmail.com>
  Date:   2021-05-17 (Mon, 17 May 2021)

  Changed paths:
    M mlir/include/mlir/IR/OpDefinition.h

  Log Message:
  -----------
  Make `mlir::OpState::operator bool` explicit

This change makes the conversion of an mlir::OpState to bool `explicit`. Idiomatic boolean uses continue to work as before, but questionable implicit uses (e.g. accumulating over a range of OpStates to count "true" states) become ill-formed. This makes the class interface a lilttle less error-prone.

I tested this change on our internal (fairly large) codebase, and only one fix was needed, which was ultimately an improvement of the affected code.

Reviewed By: rriddle, mehdi_amini

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




More information about the All-commits mailing list