Issue 97333
Summary [clang][ThreadSafety] Improve errors for trylock functions
Labels
Assignees
Reporter dmcardle
    Originally, I merged the half-baked #95290, but reverted it in #97293.

Based on feedback, I plan to make the following changes before relanding:

* [ ] Rather than locking down trylock function return types to a fixed set of types, require that they are [contextually convertible to bool](https://eel.is/c++draft/conv.general#def:conversion,contextual_to_bool). This allows for smart pointers.
* [ ] Restrict success expressions to integer/bool literals.
  * [ ] Clarify in docs that it's not an equality comparison, but a conversion after conversion to bool.
  * [ ] Explicitly disallow enumerator success expressions? This avoids suggesting that anything other than a bool conversion is happening. More discussion here: https://github.com/llvm/llvm-project/pull/95290#discussion_r1660323127
* [ ] Explicitly handle each allowed success expr type in `getMutexIDs()` rather than using `EvaluateAsBooleanCondition()`.
* [ ] Potentially add a flag that disables any new errors/warnings to enable codebases to gradually fix their annotations.


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

Reply via email to