This is an archive of the discontinued LLVM Phabricator instance.

Thread safety analysis: Store CapabilityExprs in ScopedLockableFactEntry (NFC)
ClosedPublic

Authored by aaronpuchert on Apr 20 2022, 2:29 PM.

Details

Summary

For now this doesn't make a whole lot of sense, but it will allow us to
store the capability kind in a CapabilityExpr and make sure it doesn't
get lost. The capabilities managed by a scoped lockable can of course be
of different kind, so we'll need to store that per entry.

Diff Detail

Event Timeline

aaronpuchert created this revision.Apr 20 2022, 2:29 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 20 2022, 2:29 PM
aaronpuchert requested review of this revision.Apr 20 2022, 2:29 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 20 2022, 2:29 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
aaron.ballman accepted this revision.Apr 22 2022, 5:26 AM

LGTM aside from a question (if we can't use emplace_back() the code is still fine).

clang/lib/Analysis/ThreadSafety.cpp
911–919

I think we can continue to use emplace_back() here, can't we?

This revision is now accepted and ready to land.Apr 22 2022, 5:26 AM
aaronpuchert added inline comments.Apr 25 2022, 7:26 AM
clang/lib/Analysis/ThreadSafety.cpp
911–919

For emplace_back we need a constructor and can't just do aggregate initialization. But I could omit the explicit type, like UnderlyingMutexes.push_back({M, UCK_*}).

Continues to LGTM

clang/lib/Analysis/ThreadSafety.cpp
911–919

Ah good point. No need to change anything, I was just hoping to be able to construct in place.