This is an archive of the discontinued LLVM Phabricator instance.

Thread safety analysis: Drop special block handling
ClosedPublic

Authored by aaronpuchert on Jul 23 2021, 2:27 PM.

Details

Summary

Previous changes like D101202 and D104261 have eliminated the special
status that break and continue once had, since now we're making
decisions purely based on the structure of the CFG without regard for
the underlying source code constructs.

This means we don't gain anything from defering handling for these
blocks. Dropping it moves some diagnostics, though arguably into a
better place. We're working around a "quirk" in the CFG that perhaps
wasn't visible before: while loops have an empty "transition block"
where continue statements and the regular loop exit meet, before
continuing to the loop entry. To get a source location for that, we
slightly extend our handling for empty blocks. The source location for
the transition ends up to be the loop entry then, but formally this
isn't a back edge. We pretend it is anyway. (This is safe: we can always
treat edges as back edges, it just means we allow less and don't modify
the lock set. The other way around it wouldn't be safe.)

Diff Detail

Event Timeline

aaronpuchert requested review of this revision.Jul 23 2021, 2:27 PM
aaronpuchert created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJul 23 2021, 2:27 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript

I think this looks reasonable, but @delesley should weigh in.

clang/lib/Analysis/ThreadSafety.cpp
2415

This can be removed now, correct?

2448

clang-tidy got this one right. :-)

aaronpuchert marked 2 inline comments as done.

Drop SpecialBlocks and fix clang-tidy issue.

aaron.ballman accepted this revision.Sep 20 2021, 4:46 AM

Marking this explicitly as accepted, I'd say you're fine to land and we can handle any concerns from @delesley post commit.

This revision is now accepted and ready to land.Sep 20 2021, 4:46 AM
This revision was landed with ongoing or failed builds.Sep 20 2021, 6:36 AM
This revision was automatically updated to reflect the committed changes.