[PATCH] D124131: Thread safety analysis: Store capability kind in CapabilityExpr

Aaron Puchert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 20 14:44:45 PDT 2022


aaronpuchert created this revision.
aaronpuchert added a reviewer: aaron.ballman.
Herald added a project: All.
aaronpuchert requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This should make us print the right capability kind in many more cases,
especially when attributes name multiple capabilities of different kinds.

Previously we were trying to deduce the capability kind from the
original attribute, but most attributes can name multiple capabilities,
which could be of different kinds. So instead we derive the kind when
translating the attribute expression, and then store it in the returned
CapabilityExpr. Then we can extract the corresponding capability name
when we need it, which saves us lots of plumbing and almost guarantees
that the name is right.

I didn't bother adding any tests for this because it's just a usability
improvement and it's pretty much evident from the code that we don't
fall back to "mutex" anymore (save for a few cases that I'll address in
a separate change).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124131

Files:
  clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
  clang/lib/Analysis/ThreadSafety.cpp
  clang/lib/Analysis/ThreadSafetyCommon.cpp
  clang/test/SemaCXX/warn-thread-safety-analysis.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124131.424038.patch
Type: text/x-patch
Size: 32003 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220420/85213c4d/attachment-0001.bin>


More information about the cfe-commits mailing list