[all-commits] [llvm/llvm-project] 5e7beb: [analyzer] Add PlacementNewChecker

Gabor Marton via All-commits all-commits at lists.llvm.org
Fri Jan 10 08:59:49 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 5e7beb0a4146267f1d65c57543e67ca158aca4aa
      https://github.com/llvm/llvm-project/commit/5e7beb0a4146267f1d65c57543e67ca158aca4aa
  Author: Gabor Marton <gabor.marton at ericsson.com>
  Date:   2020-01-10 (Fri, 10 Jan 2020)

  Changed paths:
    M clang/docs/analyzer/checkers.rst
    M clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
    M clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt
    A clang/lib/StaticAnalyzer/Checkers/CheckPlacementNew.cpp
    A clang/test/Analysis/placement-new-user-defined.cpp
    A clang/test/Analysis/placement-new.cpp

  Log Message:
  -----------
  [analyzer] Add PlacementNewChecker

Summary:
This checker verifies if default placement new is provided with pointers
to sufficient storage capacity.

Noncompliant Code Example:
  #include <new>
  void f() {
    short s;
    long *lp = ::new (&s) long;
  }

Based on SEI CERT rule MEM54-CPP
https://wiki.sei.cmu.edu/confluence/display/cplusplus/MEM54-CPP.+Provide+placement+new+with+properly+aligned+pointe
This patch does not implement checking of the alignment.

Reviewers: NoQ, xazax.hun

Subscribers: mgorny, whisperity, xazax.hun, baloghadamsoftware, szepet,
rnkovacs, a.sidorin, mikhail.ramalho, donat

Tags: #clang

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




More information about the All-commits mailing list