Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[clang-tidy] Add check to diagnose coroutine-hostile RAII objects #68738
[clang-tidy] Add check to diagnose coroutine-hostile RAII objects #68738
Changes from all commits
f9e2905
78e3102
6880288
ab1f823
db7d9bc
7197982
1565fae
79d0109
bd3101f
a5a88c3
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even for an locally-defined matcher, it would be helpful to have a comment on what this matcher does (the definition of "before" is non-obvious).
I also don't think its contract makes much sense: the definition of
before
excludes this:This is not just an implementation limitation but important to correctness, because we're really talking about variable scope (initialized before, but destroyed after).
But if that's the case, the matcher should also be named differently, and it should yield only
VarDecls
, because what it does doesn't make sense for anything except variables.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this implies a quadratic algorithm: every suspend point is going to walk every prior statement. (the matcher framework has memoization but it won't apply here).
It may well be fine in practice, and I don't really have a better suggestion - leaning heavily on matchers is idiomatic in clang-tidy, and is rarely efficient :-) No action needed here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's kind of unfortunate that do this based on
lock_guard
when it'smutex
that's the problem. I see instances oflock_guard
being used with spinlocks, which seem like they should be fine in coroutines.But in practice this seems like a really useful heuristic, and I don't have a better suggestion. Maybe it'll need refinement in future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it worth mentioning that/why
unique_lock
is ignored?