aaronpuchert added inline comments.

================
Comment at: clang/lib/Analysis/ThreadSafety.cpp:1644
     if (!LDat) {
-      Analyzer->Handler.handleMutexNotHeld("", D, POK, Cp.toString(),
-                                           LK_Shared, Loc);
+      Analyzer->Handler.handleMutexNotHeld("negative capability", D, POK,
+                                           Cp.toString(), LK_Shared, Loc);
----------------
aaron.ballman wrote:
> It's a bit odd that we aren't using `DiagKind` as below, I assume that's 
> because this is a negative test and the others are positive tests, but 
> doesn't this introduce a terminology difference where a positive failure may 
> call it a mutex and a negative failure may call it a negative capability? 
> Should this be hooked in to `ClassifyDiagnostic()` (perhaps we need a 
> `ClassifyNegativeDiagnostic()`?
My thinking was that whatever the positive capability is called, we should only 
talk about a "negative capability" instead of a "negative mutex" or a "negative 
role". Also because not holding a capability is in some way its own kind of 
capability.


================
Comment at: clang/test/SemaCXX/warn-thread-safety-negative.cpp:46
   void foo() {
     mu.Lock();    // expected-warning {{acquiring mutex 'mu' requires negative 
capability '!mu'}}
     baz();        // expected-warning {{cannot call function 'baz' while mutex 
'mu' is held}}
----------------
Here we're always referring to a "negative capability", I believe it's 
hardcoded into the message.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84603/new/

https://reviews.llvm.org/D84603



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to