mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 01:45:33 +02:00
Fixed f.p. for gnu compound statement expression extension
This commit is contained in:
parent
5f256a6889
commit
6882aa6e56
1 changed files with 15 additions and 1 deletions
|
@ -13,15 +13,18 @@ package org.eclipse.cdt.codan.internal.checkers;
|
|||
import org.eclipse.cdt.codan.core.cxx.model.AbstractIndexAstChecker;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||
import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTCompoundStatementExpression;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTBinaryExpression;
|
||||
|
||||
/**
|
||||
|
@ -114,8 +117,19 @@ public class StatementHasNoEffectChecker extends AbstractIndexAstChecker {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
// simply a;
|
||||
if (e instanceof IASTIdExpression) {
|
||||
// simply a;
|
||||
// check if it is part of GNU comp stmt expression i.e. ({foo();a;})
|
||||
IASTNode parent = e.getParent();
|
||||
if (parent instanceof IASTExpressionStatement) {
|
||||
IASTNode parent2 = parent.getParent();
|
||||
if (parent2 instanceof IASTCompoundStatement) {
|
||||
IASTNode parent3 = parent2.getParent();
|
||||
if (parent3 instanceof IGNUASTCompoundStatementExpression) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Add table
Reference in a new issue