This is an archive of the discontinued LLVM Phabricator instance.

[-Wunsafe-buffer-usage] Create Fix-Its only if they are emitted
ClosedPublic

Authored by jkorous on Feb 9 2023, 6:36 PM.

Diff Detail

Event Timeline

jkorous created this revision.Feb 9 2023, 6:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 9 2023, 6:36 PM
jkorous requested review of this revision.Feb 9 2023, 6:36 PM
jkorous added inline comments.Feb 9 2023, 6:39 PM
clang/lib/Analysis/UnsafeBufferUsage.cpp
1020

Since our current plan is to also change type of variables that don't directly participate in unsafe operations but would lead to correct bounds propagation the assumption in this FIXME might not be correct anymore.

I originally intended to address the FIXME in this patch but ended up just discarding it.

NoQ added inline comments.Feb 15 2023, 3:57 PM
clang/lib/Analysis/UnsafeBufferUsage.cpp
1020

Hmm, these are kind of separate.

If we're running under -fno-diagnostics-fixit-info, then yeah, we should still identify all variables that need to be fixed and explain them in notes.

If we're running below C++20, then in addition to that, we also shouldn't leave notes about "You should change this thing to span!" given that span doesn't exist.

NoQ accepted this revision.Feb 16 2023, 3:06 PM

This is probably good to go either way, we can address the note problem separately. The patch is NFC, purely a performance thing, so no tests are needed.

This revision is now accepted and ready to land.Feb 16 2023, 3:06 PM
jkorous added inline comments.Feb 17 2023, 3:37 PM
clang/lib/Analysis/UnsafeBufferUsage.cpp
1020

You are right. Let's address that in a future patch.

This revision was landed with ongoing or failed builds.Feb 23 2023, 2:48 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 23 2023, 2:48 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript