[all-commits] [llvm/llvm-project] 97dd8e: [analyzer] Clean up apiModeling.llvm.ReturnValue (...
Donát Nagy via All-commits
all-commits at lists.llvm.org
Tue May 7 04:06:32 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 97dd8e3c4f38ef345b01fbbf0a2052c7875ff7e0
https://github.com/llvm/llvm-project/commit/97dd8e3c4f38ef345b01fbbf0a2052c7875ff7e0
Author: Donát Nagy <donat.nagy at ericsson.com>
Date: 2024-05-07 (Tue, 07 May 2024)
Changed paths:
M clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
M clang/lib/StaticAnalyzer/Checkers/ReturnValueChecker.cpp
M clang/test/Analysis/return-value-guaranteed.cpp
Log Message:
-----------
[analyzer] Clean up apiModeling.llvm.ReturnValue (#91231)
This commit heavily refactors and simplifies the small and trivial
checker `apiModeling.llvm.ReturnValue`, which is responsible for
modeling the peculiar coding convention that in the LLVM/Clang codebase
certain Error() methods always return true.
Changes included in this commit:
- The call description mode is now specified explicitly (this is not the
most significant change, but it was the original reason for touching
this checker).
- Previously the code provided support for modeling functions that
always return `false`; but there was no need for that, so this commit
hardcodes that the return value is `true`.
- The overcomplicated constraint/state handling logic was simplified.
- The separate `checkEndFunction` callback was removed to simplify the
code. Admittedly this means that the note tag for the "<method> returns
false, breaking the convention" case is placed on the method call
instead of the `return` statement; but that case will _never_ appear in
practice, so this difference is mostly academical.
- The text of the note tags was clarified.
- The descriptions in the header comment and Checkers.td were clarified.
- Some minor cleanup was applied in the associated test file.
This change is very close to NFC because it only affects a hidden
`apiModeling.llvm` checker that's only relevant during the analysis of
the LLVM/Clang codebase, and even there it doesn't affect the normal
behavior of the checker.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list