[cfe-commits] r162081 - in /cfe/trunk: lib/Sema/SemaDecl.cpp lib/Sema/SemaExpr.cpp test/Index/complete-enums.cpp
Douglas Gregor
dgregor at apple.com
Thu Aug 16 22:12:08 PDT 2012
Author: dgregor
Date: Fri Aug 17 00:12:08 2012
New Revision: 162081
URL: http://llvm.org/viewvc/llvm-project?rev=162081&view=rev
Log:
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.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/Index/complete-enums.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=162081&r1=162080&r2=162081&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Aug 17 00:12:08 2012
@@ -7792,7 +7792,8 @@
// 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)) {
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=162081&r1=162080&r2=162081&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Aug 17 00:12:08 2012
@@ -9461,7 +9461,8 @@
// 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));
Modified: cfe/trunk/test/Index/complete-enums.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/complete-enums.cpp?rev=162081&r1=162080&r2=162081&view=diff
==============================================================================
--- cfe/trunk/test/Index/complete-enums.cpp (original)
+++ cfe/trunk/test/Index/complete-enums.cpp Fri Aug 17 00:12:08 2012
@@ -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 @@
int Greeby();
void f(Color color) {
switch (color) {
- case Color::Green:
+ case Color::Green: { X x; }
case Color::Red;
}
}
More information about the cfe-commits
mailing list