[all-commits] [llvm/llvm-project] 86b6df: [libc++] Fix Coverity warning about use-after-move...

Louis Dionne via All-commits all-commits at lists.llvm.org
Sun Jan 21 13:24:16 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 86b6dfc619695b5bfb1880b2ed9abb4a6805fbe6
      https://github.com/llvm/llvm-project/commit/86b6dfc619695b5bfb1880b2ed9abb4a6805fbe6
  Author: Louis Dionne <ldionne.2 at gmail.com>
  Date:   2024-01-21 (Sun, 21 Jan 2024)

  Changed paths:
    M libcxx/include/variant

  Log Message:
  -----------
  [libc++] Fix Coverity warning about use-after-move (#78780)

While the code is technically correct because the index is never
actually moved from (and anyway that wouldn't matter since it's an
integer), it's still better style not to access an object after it has
been moved-from. Since this is so easy to do, just save the index in a
temporary variable.

rdar://120501577




More information about the All-commits mailing list