mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 352983 - internal error in switch isFallThroughStatement
This commit is contained in:
parent
0d7bc691d2
commit
fe6f2ae68f
2 changed files with 17 additions and 2 deletions
|
@ -139,7 +139,11 @@ public class CaseBreakChecker extends AbstractIndexAstChecker implements IChecke
|
||||||
if (body == null) return true;
|
if (body == null) return true;
|
||||||
if (body instanceof IASTCompoundStatement) {
|
if (body instanceof IASTCompoundStatement) {
|
||||||
IASTStatement[] statements = ((IASTCompoundStatement) body).getStatements();
|
IASTStatement[] statements = ((IASTCompoundStatement) body).getStatements();
|
||||||
|
if (statements.length > 0) {
|
||||||
return isFallThroughStamement(statements[statements.length - 1]);
|
return isFallThroughStamement(statements[statements.length - 1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
} else if (isBreakOrExitStatement(body)) {
|
} else if (isBreakOrExitStatement(body)) {
|
||||||
return false;
|
return false;
|
||||||
} else if (body instanceof IASTExpressionStatement) {
|
} else if (body instanceof IASTExpressionStatement) {
|
||||||
|
|
|
@ -558,5 +558,16 @@ public class CaseBreakCheckerTest extends CheckerTestCase {
|
||||||
checkNoErrors();
|
checkNoErrors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//void foo()
|
||||||
|
//{
|
||||||
|
//switch(0)
|
||||||
|
//default:
|
||||||
|
//{
|
||||||
|
//}
|
||||||
|
//}
|
||||||
|
public void testEmptyCompoundStatement() {
|
||||||
|
String code = getAboveComment();
|
||||||
|
loadCodeAndRun(code);
|
||||||
|
checkErrorLine(4);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue