[all-commits] [llvm/llvm-project] 230946: [ADT] Mark reverse and concat as nodiscard (#115611)

Jakub Kuderski via All-commits all-commits at lists.llvm.org
Sat Nov 9 12:19:26 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 230946fad69c952dc434aa3e2f92853c1ee8d304
      https://github.com/llvm/llvm-project/commit/230946fad69c952dc434aa3e2f92853c1ee8d304
  Author: Jakub Kuderski <jakub at nod-labs.com>
  Date:   2024-11-09 (Sat, 09 Nov 2024)

  Changed paths:
    M llvm/include/llvm/ADT/STLExtras.h

  Log Message:
  -----------
  [ADT] Mark reverse and concat as nodiscard (#115611)

It may not be immediately obvious if these two functions modify the
given ranges or return a view over them. We have seen downstream code
that mistakenly assumed the given range would be mutated.

Add the `[[nodiscard]]` attribute to prevent these errors. Also clarify
the lack of mutation in the documentation comments.



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