forked from OSchip/llvm-project
Don't do jump-scope checking when code completion is enabled. It's
both a waste of time, and prone to crash due to the use of the error-recovery path in parser. Fixes <rdar://problem/12103608>, which has been driving me nuts. llvm-svn: 162081
This commit is contained in:
parent
8d9ccdc7a5
commit
5d944dbf1a
|
@ -7792,7 +7792,8 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body,
|
|||
// Verify that gotos and switch cases don't jump into scopes illegally.
|
||||
if (getCurFunction()->NeedsScopeChecking() &&
|
||||
!dcl->isInvalidDecl() &&
|
||||
!hasAnyUnrecoverableErrorsInThisFunction())
|
||||
!hasAnyUnrecoverableErrorsInThisFunction() &&
|
||||
!PP.isCodeCompletionEnabled())
|
||||
DiagnoseInvalidJumps(Body);
|
||||
|
||||
if (CXXDestructorDecl *Destructor = dyn_cast<CXXDestructorDecl>(dcl)) {
|
||||
|
|
|
@ -9461,7 +9461,8 @@ ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc,
|
|||
|
||||
// If needed, diagnose invalid gotos and switches in the block.
|
||||
if (getCurFunction()->NeedsScopeChecking() &&
|
||||
!hasAnyUnrecoverableErrorsInThisFunction())
|
||||
!hasAnyUnrecoverableErrorsInThisFunction() &&
|
||||
!PP.isCodeCompletionEnabled())
|
||||
DiagnoseInvalidJumps(cast<CompoundStmt>(Body));
|
||||
|
||||
BSI->TheDecl->setBody(cast<CompoundStmt>(Body));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Note: the run lines follow their respective tests, since line/column
|
||||
// matter in this test.
|
||||
|
||||
struct X { X(); ~X(); };
|
||||
enum class Color {
|
||||
Red = 17,
|
||||
Green,
|
||||
|
@ -9,7 +9,7 @@ enum class Color {
|
|||
int Greeby();
|
||||
void f(Color color) {
|
||||
switch (color) {
|
||||
case Color::Green:
|
||||
case Color::Green: { X x; }
|
||||
case Color::Red;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue