mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 10:46:02 +02:00
Cosmetics.
This commit is contained in:
parent
ae7dc29df9
commit
03021e3af2
1 changed files with 4 additions and 8 deletions
|
@ -53,7 +53,6 @@ import org.eclipse.cdt.internal.core.pdom.dom.PDOMName;
|
||||||
* of methods that are working with their value.
|
* of methods that are working with their value.
|
||||||
*
|
*
|
||||||
* @author Anton Gorenkov
|
* @author Anton Gorenkov
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
|
public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
|
||||||
public static final String ER_ID = "org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization"; //$NON-NLS-1$
|
public static final String ER_ID = "org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization"; //$NON-NLS-1$
|
||||||
|
@ -65,7 +64,6 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
|
||||||
}
|
}
|
||||||
|
|
||||||
class OnEachClass extends ASTVisitor {
|
class OnEachClass extends ASTVisitor {
|
||||||
|
|
||||||
// NOTE: Classes can be nested and even can be declared in constructors of the other classes
|
// NOTE: Classes can be nested and even can be declared in constructors of the other classes
|
||||||
private final Stack< Set<IField> > constructorsStack = new Stack< Set<IField> >();
|
private final Stack< Set<IField> > constructorsStack = new Stack< Set<IField> >();
|
||||||
private boolean skipConstructorsWithFCalls = skipConstructorsWithFCalls();
|
private boolean skipConstructorsWithFCalls = skipConstructorsWithFCalls();
|
||||||
|
@ -133,9 +131,9 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bug 368420 - Skip constructor if pattern is *this = toBeCopied;
|
// Bug 368420 - Skip constructor if pattern is *this = toBeCopied;
|
||||||
if(expression instanceof IASTBinaryExpression) {
|
if (expression instanceof IASTBinaryExpression) {
|
||||||
IASTBinaryExpression binaryExpression = (IASTBinaryExpression) expression;
|
IASTBinaryExpression binaryExpression = (IASTBinaryExpression) expression;
|
||||||
if(referencesThis(binaryExpression.getOperand1()) && binaryExpression.getOperand1().isLValue()) {
|
if (referencesThis(binaryExpression.getOperand1()) && binaryExpression.getOperand1().isLValue()) {
|
||||||
skipCurrentConstructor = true;
|
skipCurrentConstructor = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,8 +144,8 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Checks whether expression references this (directly, by pointer or by reference)
|
/**
|
||||||
*
|
* Checks whether expression references this (directly, by pointer or by reference)
|
||||||
*/
|
*/
|
||||||
public boolean referencesThis(IASTNode expr) {
|
public boolean referencesThis(IASTNode expr) {
|
||||||
if (expr instanceof IASTLiteralExpression) {
|
if (expr instanceof IASTLiteralExpression) {
|
||||||
|
@ -224,7 +222,6 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -236,5 +233,4 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
|
||||||
public boolean skipConstructorsWithFCalls() {
|
public boolean skipConstructorsWithFCalls() {
|
||||||
return (Boolean) getPreference(getProblemById(ER_ID, getFile()), PARAM_SKIP);
|
return (Boolean) getPreference(getProblemById(ER_ID, getFile()), PARAM_SKIP);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue