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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162081
91177308-0d34-0410-b5e6-
96231b3b80d8
// 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)) {
// 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));
// 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,
int Greeby();
void f(Color color) {
switch (color) {
- case Color::Green:
+ case Color::Green: { X x; }
case Color::Red;
}
}