Skip to content
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

[ir] Add nodiscard to get_loop_guard/get_if_guard #2377

Merged
merged 5 commits into from May 29, 2021

Conversation

xumingkuan
Copy link
Collaborator

Related issue = #2193

This PR warns CHI users when they write builder.get_loop_guard(loop); which has no effect. The correct usage is auto _ = builder.get_loop_guard(loop);.

[Click here for the format server]


@@ -92,8 +92,7 @@ class IRBuilder {
template <typename XStmt>
[[nodiscard]] LoopGuard get_loop_guard(XStmt *loop) {
return LoopGuard(*this, loop);
}
[[nodiscard]] IfGuard get_if_guard(IfStmt *if_stmt, bool true_branch) {
}[[nodiscard]] IfGuard get_if_guard(IfStmt *if_stmt, bool true_branch) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(?)

@xumingkuan xumingkuan removed the request for review from taichi-gardener May 29, 2021 07:58
@xumingkuan xumingkuan merged commit 51e510b into taichi-dev:master May 29, 2021
@k-ye k-ye mentioned this pull request Jun 7, 2021
@xumingkuan xumingkuan deleted the nodiscard branch June 8, 2021 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants