[PATCH] D26350: Keep invalid Switch in the AST

2018-02-28 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: lib/Sema/SemaStmt.cpp:823 + CondExpr->isValueDependent() || + isa(CondExpr); + unsigned CondWidth = rsmith wrote: > It's fragile to assume that the

[PATCH] D26350: Keep invalid Switch in the AST

2018-02-28 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments. Comment at: lib/Sema/SemaStmt.cpp:823 + CondExpr->isValueDependent() || + isa(CondExpr); + unsigned CondWidth = It's fragile to assume that the only way you can see a

[PATCH] D26350: Keep invalid Switch in the AST

2017-10-16 Thread Olivier Goffart via Phabricator via cfe-commits
ogoffart updated this revision to Diff 119142. ogoffart added a comment. Updated the patch so that ActOnStartOfSwitchStmt returns void, and ActOnFinishSwitchStmt will skip some checks in case of error https://reviews.llvm.org/D26350 Files: include/clang/Sema/Sema.h lib/Parse/ParseStmt.cpp

[PATCH] D26350: Keep invalid Switch in the AST

2017-10-10 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments. Comment at: lib/Parse/ParseStmt.cpp:1297 - if (Switch.isInvalid()) { -// Skip the switch body. -// FIXME: This is not optimal recovery, but parsing the body is more -// dangerous due to the presence of case and default statements, whic

[PATCH] D26350: Keep invalid Switch in the AST

2017-07-27 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. This looks reasonable to me, but you should wait for @rsmith to sign off before committing. Comment at: lib/Sema/SemaStmt.cpp:669 if (Cond.isInvalid()) -return StmtError(); +Cond = ConditionResult( +*this, nullptr,

[PATCH] D26350: Keep invalid Switch in the AST

2017-07-14 Thread Olivier Goffart via Phabricator via cfe-commits
ogoffart added a comment. Thanks for your review and i'll try to address the concerns. I believe tools that really need valid code relies on the diagnostics and bail out on error. On the other hand, tools that may work on code containing error do a best effort to work on the remaining AST . And

[PATCH] D26350: Keep invalid Switch in the AST

2017-07-14 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In https://reviews.llvm.org/D26350#809577, @ogoffart wrote: > The problem i'm trying to solve is precisely to keep as much as possible of > the valid AST in the main AST, despite errors. > I've already done some work with r249982, r272962 and more, and there is >

[PATCH] D26350: Keep invalid Switch in the AST

2017-07-14 Thread Olivier Goffart via Phabricator via cfe-commits
ogoffart added a comment. The problem i'm trying to solve is precisely to keep as much as possible of the valid AST in the main AST, despite errors. I've already done some work with r249982, r272962 and more, and there is still a lot to do. But the goal is to keep as much as possible of it. The

[PATCH] D26350: Keep invalid Switch in the AST

2017-07-14 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. You've explained how you are accomplishing this but not why. I don't think Clang typically keeps erroneous AST nodes in the tree. What kind of problem is this intended to solve? https://reviews.llvm.org/D26350 ___ cf

[PATCH] D26350: Keep invalid Switch in the AST

2017-07-14 Thread Olivier Goffart via Phabricator via cfe-commits
ogoffart added a comment. re-ping https://reviews.llvm.org/D26350 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D26350: Keep invalid Switch in the AST

2017-03-17 Thread Olivier Goffart via Phabricator via cfe-commits
ogoffart added a comment. Ping https://reviews.llvm.org/D26350 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D26350: Keep invalid Switch in the AST

2016-12-22 Thread Olivier Goffart via Phabricator via cfe-commits
ogoffart added a comment. ping2 https://reviews.llvm.org/D26350 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D26350: Keep invalid Switch in the AST

2016-11-20 Thread Olivier Goffart via cfe-commits
ogoffart added a comment. ping? https://reviews.llvm.org/D26350 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D26350: Keep invalid Switch in the AST

2016-11-07 Thread Olivier Goffart via cfe-commits
ogoffart added a comment. I believe only the change in ActOnFinishSwitchStmt might be controversial. Is it breaking an invariant than having switches kept in the AST? https://reviews.llvm.org/D26350 ___ cfe-commits mailing list cfe-commits@lists.ll

[PATCH] D26350: Keep invalid Switch in the AST

2016-11-07 Thread Olivier Goffart via cfe-commits
ogoffart created this revision. ogoffart added reviewers: rsmith, cfe-commits. - When the condition is invalid, replace it by an OpaqueValueExpr - When parsing an invalid CaseStmt, don't drop the sub statement, just return it instead. - In Sema::ActOnStartOfSwitchStmt, always keep the SwitchSt