[all-commits] [llvm/llvm-project] 148dc8: [-Wunsafe-buffer-usage] Reducing non-determinism i...

Ziqing Luo via All-commits all-commits at lists.llvm.org
Mon Mar 13 17:22:51 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 148dc8a2a80f6b4ab80914c153279205a78315ed
      https://github.com/llvm/llvm-project/commit/148dc8a2a80f6b4ab80914c153279205a78315ed
  Author: ziqingluo-90 <ziqing at udel.edu>
  Date:   2023-03-13 (Mon, 13 Mar 2023)

  Changed paths:
    M clang/lib/Analysis/UnsafeBufferUsage.cpp
    M clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-local-var-span.cpp

  Log Message:
  -----------
  [-Wunsafe-buffer-usage] Reducing non-determinism in diagnostics output stream

The -Wunsafe-buffer-usage analysis outputs diagnostics in the order of
pointer values to associated `VarDecl`s. This creates non-determinism
in the order of diagnostics in output since the order cannot be
guaranteed in pointer values. However, our fix-it tests were written
under the assumption that diagnostics are output in source location
order.  This results in non-deterministic failures in our tests.  This
patch fixes the problem by keeping analysis results sorted by source
locations.

Reviewed by: jkorous, NoQ

Differential revision: https://reviews.llvm.org/D145993




More information about the All-commits mailing list