[all-commits] [llvm/llvm-project] da0660: [clang][analyzer] No new nodes when bug is detecte...

Balázs Kéri via All-commits all-commits at lists.llvm.org
Wed Dec 14 00:53:05 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: da0660691f74b0350dee8e15f4ac942457e397e4
      https://github.com/llvm/llvm-project/commit/da0660691f74b0350dee8e15f4ac942457e397e4
  Author: Balázs Kéri <1.int32 at gmail.com>
  Date:   2022-12-14 (Wed, 14 Dec 2022)

  Changed paths:
    M clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
    M clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
    M clang/test/Analysis/std-c-library-functions-arg-constraints.c

  Log Message:
  -----------
  [clang][analyzer] No new nodes when bug is detected in StdLibraryFunctionsChecker.

The checker applies constraints in a sequence and adds new nodes for these states.
If a constraint violation is found this sequence should be stopped with a sink
(error) node. Instead the `generateErrorNode` did add a new error node as a new
branch that is parallel to the other node sequence, the other branch was not
stopped and analysis was continuing on that invalid branch.
To add an error node after any previous node a new version of `generateErrorNode`
is needed, this function is added here and used by `StdLibraryFunctionsChecker`.
The added test executes a situation where the checker adds a number of
constraints before it finds a constraint violation.

Reviewed By: NoQ

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




More information about the All-commits mailing list