[all-commits] [llvm/llvm-project] 3e6f61: [llvm][ADT] Add `getSingleElement` helper (#131508)

Matthias Springer via All-commits all-commits at lists.llvm.org
Sun Mar 16 13:20:57 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3e6f618e86f5fbad2c2d5802416ec3d3366a2837
      https://github.com/llvm/llvm-project/commit/3e6f618e86f5fbad2c2d5802416ec3d3366a2837
  Author: Matthias Springer <me at m-sp.org>
  Date:   2025-03-16 (Sun, 16 Mar 2025)

  Changed paths:
    M llvm/include/llvm/ADT/STLExtras.h
    M llvm/unittests/ADT/STLExtrasTest.cpp

  Log Message:
  -----------
  [llvm][ADT] Add `getSingleElement` helper (#131508)

This commit adds a new helper function: `getSingleElement`

This function asserts that the container has a single element and then
returns that element. This helper function is useful during 1:N dialect
conversions in MLIR, where certain `ValueRange`s (returned from the
adaptor) are known to have a single value.



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