[PATCH] D123352: [analyzer] Add FixItHint to `nullability.NullReturnedFromNonnull` and `nullability.NullableReturnedFromNonnull`
Moshe via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 7 18:43:35 PDT 2022
MosheBerman created this revision.
Herald added subscribers: manas, steakhal, ASDenysPetrov, martong, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun.
Herald added a project: All.
MosheBerman requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
This diff adds:
- A `CmdLineOption` called `ShowFixIts` to the all of nullability checks. (We add to all of them because of the way `NullabilityChecker.cpp` registers all of the checkers.)
- For each of the two `*ReturnedFromNonnull` methods, attaches a `FixItHint` to the output.
Use Case:
This enables us to automate the process of annotating headers with `NS_ASSUME_NONNULL_BEGIN/END` because the checker can fix callsites where we would otherwise break the nullability contract.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D123352
Files:
clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
clang/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
clang/test/Analysis/nullability-fixits.mm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123352.421382.patch
Type: text/x-patch
Size: 12811 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220408/51d1584b/attachment.bin>
More information about the cfe-commits
mailing list