mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
03f572e385
commit
467bbc0b52
1 changed files with 15 additions and 17 deletions
|
@ -114,15 +114,15 @@ public class AbstractClassInstantiationChecker extends AbstractIndexAstChecker {
|
||||||
IASTName className = ((ICPPASTNamedTypeSpecifier) declSpec).getName();
|
IASTName className = ((ICPPASTNamedTypeSpecifier) declSpec).getName();
|
||||||
IBinding binding = className.resolveBinding();
|
IBinding binding = className.resolveBinding();
|
||||||
if (binding instanceof IType) {
|
if (binding instanceof IType) {
|
||||||
// Resolve class and check whether it is abstract
|
// Resolve class and check whether it is abstract.
|
||||||
reportProblemsIfAbstract((IType) binding, className);
|
reportProblemsIfAbstract((IType) binding, className);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int visit(IASTExpression expression) {
|
public int visit(IASTExpression expression) {
|
||||||
// Looking for the new expression
|
|
||||||
if (expression instanceof ICPPASTNewExpression) {
|
if (expression instanceof ICPPASTNewExpression) {
|
||||||
|
// New expression.
|
||||||
ICPPASTNewExpression newExpression = (ICPPASTNewExpression) expression;
|
ICPPASTNewExpression newExpression = (ICPPASTNewExpression) expression;
|
||||||
if (!hasPointerOrReference(newExpression.getTypeId().getAbstractDeclarator())) {
|
if (!hasPointerOrReference(newExpression.getTypeId().getAbstractDeclarator())) {
|
||||||
// Try to resolve its implicit constructor
|
// Try to resolve its implicit constructor
|
||||||
|
@ -132,9 +132,8 @@ public class AbstractClassInstantiationChecker extends AbstractIndexAstChecker {
|
||||||
checkClassConstructor(constructorName);
|
checkClassConstructor(constructorName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (expression instanceof ICPPASTFunctionCallExpression) {
|
||||||
// Looking for direct class constructor call and check it.
|
// Direct constructor call.
|
||||||
else if (expression instanceof ICPPASTFunctionCallExpression) {
|
|
||||||
ICPPASTFunctionCallExpression functionCall = (ICPPASTFunctionCallExpression) expression;
|
ICPPASTFunctionCallExpression functionCall = (ICPPASTFunctionCallExpression) expression;
|
||||||
IASTExpression functionName = functionCall.getFunctionNameExpression();
|
IASTExpression functionName = functionCall.getFunctionNameExpression();
|
||||||
if (functionName instanceof IASTIdExpression) {
|
if (functionName instanceof IASTIdExpression) {
|
||||||
|
@ -154,8 +153,7 @@ public class AbstractClassInstantiationChecker extends AbstractIndexAstChecker {
|
||||||
if (binding instanceof ICPPConstructor) {
|
if (binding instanceof ICPPConstructor) {
|
||||||
// Resolve class and check whether it is abstract.
|
// Resolve class and check whether it is abstract.
|
||||||
reportProblemsIfAbstract(((ICPPConstructor) binding).getClassOwner(), constructorName);
|
reportProblemsIfAbstract(((ICPPConstructor) binding).getClassOwner(), constructorName);
|
||||||
}
|
} else if (binding instanceof IType) {
|
||||||
else if (binding instanceof IType) {
|
|
||||||
reportProblemsIfAbstract((IType) binding, constructorName);
|
reportProblemsIfAbstract((IType) binding, constructorName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue