[PATCH] D143680: [WIP][-Wunsafe-buffer-usage] Improve fix-its for local variable declarations with null pointer initializers
Ziqing Luo via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 9 14:16:37 PST 2023
ziqingluo-90 created this revision.
ziqingluo-90 added reviewers: jkorous, NoQ, t-rasmud, malavikasamak.
Herald added a project: All.
ziqingluo-90 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
For a local pointer declaration of the form `T * p = 0` or `T * p.= std::nullptr`, we generate fix-its that convert the declaration to `std::span<T> p {nullptr, <# placeholder #>}`, in cases where `p` is used in some unsafe operations.
This patch improves the fix-its to result in a simpler form `std::span<T> p`. It gets rid of the placeholder and keeps the result concise.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D143680
Files:
clang/lib/Analysis/UnsafeBufferUsage.cpp
clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-local-var-span.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143680.496232.patch
Type: text/x-patch
Size: 6116 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230209/b76ec55a/attachment.bin>
More information about the cfe-commits
mailing list