[all-commits] [llvm/llvm-project] ec6da3: Fix false positive related to handling of [[noretu...

Arseniy Zaostrovnykh via All-commits all-commits at lists.llvm.org
Wed Oct 12 05:47:16 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ec6da3fb9d8c7859da22d9eb7e814faf2e5a524a
      https://github.com/llvm/llvm-project/commit/ec6da3fb9d8c7859da22d9eb7e814faf2e5a524a
  Author: Arseniy Zaostrovnykh <arseniy.zaostrovnykh at sonarsource.com>
  Date:   2022-10-12 (Wed, 12 Oct 2022)

  Changed paths:
    M clang/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp
    A clang/test/Analysis/no-return.c

  Log Message:
  -----------
  Fix false positive related to handling of [[noreturn]] function pointers

Before this change, the `NoReturnFunctionChecker` was missing function pointers
with a `[[noreturn]]` attribute, while `CFG` was constructed taking that into
account, which leads CSA to take impossible paths. The reason was that the
`NoReturnFunctionChecker` was looking for the attribute in the type of the
entire call expression rather than the type of the function being called.

This change makes the `[[noreturn]]` attribute of a function pointer visible
to `NoReturnFunctionChecker`. This leads to a more coherent behavior of the
CSA on the AST involving.

Reviewed By: xazax.hun

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




More information about the All-commits mailing list