[PATCH] D51187: [RFC] Thread safety analysis: Track status of scoped capability

Delesley Hutchins via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 19 16:18:43 PDT 2018


delesley added inline comments.


================
Comment at: lib/Analysis/ThreadSafety.cpp:929
+      return Handler.handleDoubleLock(DiagKind, entry.toString(), entry.loc());
+    Locked = true;
+
----------------
It's been a while since I last looked at this code, but I don't think you can use mutable fields in a FactEntry.  The analysis creates a FactSet for each program point, but each FactSet simply has pointers (FactIDs) for the underlying FactEntries.  If you change the definition of a FactEntry, it will change that definition for every program point.  So if you do an unlock on one side of a branch, and change the underlying FactEntry to reflect that, then analysis will then think you have also done the unlock on the other side of the branch.  

Any changes should always be done by adding or removing entries from the FactSet, not by mutating the underlying FactEntries.



Repository:
  rC Clang

https://reviews.llvm.org/D51187





More information about the cfe-commits mailing list