This is an archive of the discontinued LLVM Phabricator instance.

Thread safety analysis: Replace flags in FactEntry by SourceKind [NFC]
ClosedPublic

Authored by aaronpuchert on Apr 19 2021, 3:05 PM.

Details

Summary

The motivation here is to make it available in the base class whether a
fact is managed or not. That would have meant three flags on the base
class, so I had a look whether we really have 8 possible combinations.

It turns out we don't: asserted and declared are obviously mutually
exclusive. Managed facts are only created when we acquire a capability
through a scoped capability. Adopting an asserted or declared lock will
not (in fact can not, because Facts are immutable) make them managed.

We probably don't want to allow adopting an asserted lock (because then
the function should probably have a release attribute, and then the
assertion is pointless), but we might at some point decide to replace a
declared fact on adoption.

Diff Detail

Event Timeline

aaronpuchert requested review of this revision.Apr 19 2021, 3:05 PM
aaronpuchert created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptApr 19 2021, 3:05 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
aaron.ballman accepted this revision.Apr 30 2021, 5:55 AM

LGTM aside from a formatting nit. Thanks, this is more clear than a set of booleans.

clang/lib/Analysis/ThreadSafety.cpp
138

Might as well fix the clang-tidy diagnostic (we don't usually try to line up function qualifiers like that).

This revision is now accepted and ready to land.Apr 30 2021, 5:55 AM
This revision was landed with ongoing or failed builds.May 3 2021, 5:03 AM
This revision was automatically updated to reflect the committed changes.
aaronpuchert marked an inline comment as done.