[all-commits] [llvm/llvm-project] b7586a: [analyzer][StdLibraryFunctionsChecker] Remove strc...

Gabor Marton via All-commits all-commits at lists.llvm.org
Thu Sep 10 03:31:55 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: b7586afc4dcddd1abc70724585c3eb3857e27f43
      https://github.com/llvm/llvm-project/commit/b7586afc4dcddd1abc70724585c3eb3857e27f43
  Author: Gabor Marton <gabor.marton at ericsson.com>
  Date:   2020-09-10 (Thu, 10 Sep 2020)

  Changed paths:
    M clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
    M clang/test/Analysis/std-c-library-functions-POSIX.c
    A clang/test/Analysis/std-c-library-functions-arg-cstring-dependency.c

  Log Message:
  -----------
  [analyzer][StdLibraryFunctionsChecker] Remove strcasecmp

There are 2 reasons to remove strcasecmp and strncasecmp.
1) They are also modeled in CStringChecker and the related argumentum
   contraints are checked there.
2) The argument constraints are checked in CStringChecker::evalCall.
   This is fundamentally flawed, they should be checked in checkPreCall.
   Even if we set up CStringChecker as a weak dependency for
   StdLibraryFunctionsChecker then the latter reports the warning always.
   Besides, CStringChecker fails to discover the constraint violation
   before the call, so, its evalCall returns with `true` and then
   StdCLibraryFunctions also tries to evaluate, this causes an assertion
   in CheckerManager.

Either we fix CStringChecker to handle the call prerequisites in
checkPreCall, or we must not evaluate any pure functions in
StdCLibraryFunctions that are also handled in CStringChecker.
We do the latter in this patch.

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




More information about the All-commits mailing list