[all-commits] [llvm/llvm-project] 200007: [-Wunsafe-buffer-usage] Initial commit - Transitio...

NoQ via All-commits all-commits at lists.llvm.org
Mon Dec 5 15:13:58 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 200007ec85f81122fd260a4e68308e54607ca37a
      https://github.com/llvm/llvm-project/commit/200007ec85f81122fd260a4e68308e54607ca37a
  Author: Artem Dergachev <adergachev at apple.com>
  Date:   2022-12-05 (Mon, 05 Dec 2022)

  Changed paths:
    A clang/include/clang/Analysis/Analyses/UnsafeBufferUsage.h
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Analysis/CMakeLists.txt
    A clang/lib/Analysis/UnsafeBufferUsage.cpp
    M clang/lib/Sema/AnalysisBasedWarnings.cpp
    A clang/test/SemaCXX/warn-unsafe-buffer-usage.cpp

  Log Message:
  -----------
  [-Wunsafe-buffer-usage] Initial commit - Transition away from raw buffers.

This is the initial commit for -Wunsafe-buffer-usage, a warning that helps
codebases (especially modern C++ codebases) transition away from raw buffer
pointers.

The warning is implemented in libAnalysis as it's going to become a non-trivial
analysis, mostly the fixit part where we try to figure out if we understand
a variable's use pattern well enough to suggest a safe container/view
as a replacement. Some parts of this analsysis may eventually prove useful
for any similar fixit machine that tries to change types of variables.

The warning is disabled by default.

RFC/discussion in https://discourse.llvm.org/t/rfc-c-buffer-hardening/65734

Differential Revision: https://reviews.llvm.org/D137346




More information about the All-commits mailing list