[all-commits] [llvm/llvm-project] 6d861d: [-Wunsafe-buffer-usage] Move the whole analysis to...

Ziqing Luo via All-commits all-commits at lists.llvm.org
Fri May 12 11:52:51 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6d861d498de1320d22771c329ec69f9419ef06b7
      https://github.com/llvm/llvm-project/commit/6d861d498de1320d22771c329ec69f9419ef06b7
  Author: ziqingluo-90 <ziqing at udel.edu>
  Date:   2023-05-12 (Fri, 12 May 2023)

  Changed paths:
    M clang/include/clang/Sema/AnalysisBasedWarnings.h
    M clang/lib/Sema/AnalysisBasedWarnings.cpp
    M clang/lib/Sema/Sema.cpp
    M clang/test/SemaCXX/warn-unsafe-buffer-usage.cpp

  Log Message:
  -----------
  [-Wunsafe-buffer-usage] Move the whole analysis to the end of a translation unit

The unsafe-buffer analysis requires a complete view of the translation
unit (TU) to be conservative. So the analysis is moved to the end of a
TU.

A summary of changes made: add a new `IssueWarnings` function in
`AnalysisBasedWarnings.cpp` for TU-based analyses. So far
[-Wunsafe-buffer-usage] is the only analysis using it but there could
be more.  `Sema` will call the new `IssueWarnings` function at the end
of parsing a TU.

Reviewed by: NoQ (Artem Dergachev)

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




More information about the All-commits mailing list