[all-commits] [llvm/llvm-project] bd9e23: [analyzer] Expand conversion check to check more e...

Gabor Marton via All-commits all-commits at lists.llvm.org
Wed Dec 15 02:41:52 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bd9e23943a2299804172da69b308533241f99b60
      https://github.com/llvm/llvm-project/commit/bd9e23943a2299804172da69b308533241f99b60
  Author: Gabor Marton <gabor.marton at ericsson.com>
  Date:   2021-12-15 (Wed, 15 Dec 2021)

  Changed paths:
    M clang/lib/StaticAnalyzer/Checkers/ConversionChecker.cpp
    M clang/test/Analysis/conversion.c
    A clang/test/Analysis/conversion.cpp

  Log Message:
  -----------
  [analyzer] Expand conversion check to check more expressions for overflow and underflow

This expands checking for more expressions. This will check underflow
and loss of precision when using call expressions like:

  void foo(unsigned);
  int i = -1;
  foo(i);

This also includes other expressions as well, so it can catch negative
indices to std::vector since it uses unsigned integers for [] and .at()
function.

Patch by: @pfultz2

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




More information about the All-commits mailing list