[PATCH] D85984: [analyzer] Add a new checker alpha.cplusplus.CPlusPlus11Lock

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 7 07:58:56 PDT 2020


steakhal added a comment.

I have checked only your test, but the readability of the reports should be improved.
You frequently refer to previous events, such as `This lock has already been unlocked`, `This lock has already been acquired`, etc.
It isn't clear to the reader where do you refer to. IMO you should put a //NoteTag// at the interesting locations to achieve more readable diagnostics.

Such as:

  void stms_bad2() {
    stm1.lock();        // expected-note {{Previously locked here}}
    stm1.lock_shared(); // expected-warning {{This lock has already been acquired}}
  }

  void stm_bad3() {
    stm1.lock();   // hmm, might be a good idea to put one note here too
    stm2.lock();   // expected-note {{Previously locked mutex}}
    stm1.unlock(); // expected-warning {{This was not the most recently acquired lock. Possible lock order reversal}}
    stm2.unlock(); // no-warning
  }


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

https://reviews.llvm.org/D85984



More information about the cfe-commits mailing list