Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2011-07-31 04:52:14 +0000
committerSergey Prigogin2011-07-31 06:03:02 +0000
commit14afc9f4f44602d7ddf351a2f391c4a3702e1b61 (patch)
tree180c6db4a3be6054680ca55271479a6e853d11c8 /codan/org.eclipse.cdt.codan.checkers
parent43df92cc7649eea3d03821f8631d888b070a57d5 (diff)
downloadorg.eclipse.cdt-14afc9f4f44602d7ddf351a2f391c4a3702e1b61.tar.gz
org.eclipse.cdt-14afc9f4f44602d7ddf351a2f391c4a3702e1b61.tar.xz
org.eclipse.cdt-14afc9f4f44602d7ddf351a2f391c4a3702e1b61.zip
Cosmetics.
Diffstat (limited to 'codan/org.eclipse.cdt.codan.checkers')
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AbstractClassInstantiationChecker.java32
1 files changed, 15 insertions, 17 deletions
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AbstractClassInstantiationChecker.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AbstractClassInstantiationChecker.java
index 6554b9ed9d4..33028a04ed6 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AbstractClassInstantiationChecker.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AbstractClassInstantiationChecker.java
@@ -79,7 +79,7 @@ public class AbstractClassInstantiationChecker extends AbstractIndexAstChecker {
// Looking for the variables declarations.
if (declaration instanceof IASTSimpleDeclaration) {
// If there is at least one non-pointer and non-reference type...
- IASTSimpleDeclaration simpleDecl = (IASTSimpleDeclaration)declaration;
+ IASTSimpleDeclaration simpleDecl = (IASTSimpleDeclaration) declaration;
IASTDeclSpecifier declSpec = simpleDecl.getDeclSpecifier();
if (declSpec.getStorageClass() != IASTDeclSpecifier.sc_typedef) {
for (IASTDeclarator declarator : simpleDecl.getDeclarators()) {
@@ -111,34 +111,33 @@ public class AbstractClassInstantiationChecker extends AbstractIndexAstChecker {
private void checkClass(IASTDeclSpecifier declSpec) {
if (declSpec instanceof ICPPASTNamedTypeSpecifier) {
- IASTName className = ((ICPPASTNamedTypeSpecifier)declSpec).getName();
+ IASTName className = ((ICPPASTNamedTypeSpecifier) declSpec).getName();
IBinding binding = className.resolveBinding();
if (binding instanceof IType) {
- // Resolve class and check whether it is abstract
- reportProblemsIfAbstract((IType)binding, className);
+ // Resolve class and check whether it is abstract.
+ reportProblemsIfAbstract((IType) binding, className);
}
}
}
public int visit(IASTExpression expression) {
- // Looking for the new expression
if (expression instanceof ICPPASTNewExpression) {
- ICPPASTNewExpression newExpression = (ICPPASTNewExpression)expression;
+ // New expression.
+ ICPPASTNewExpression newExpression = (ICPPASTNewExpression) expression;
if (!hasPointerOrReference(newExpression.getTypeId().getAbstractDeclarator())) {
// Try to resolve its implicit constructor
IASTDeclSpecifier declSpecifier = newExpression.getTypeId().getDeclSpecifier();
if (declSpecifier instanceof ICPPASTNamedTypeSpecifier) {
- IASTName constructorName = ((ICPPASTNamedTypeSpecifier)declSpecifier).getName();
+ IASTName constructorName = ((ICPPASTNamedTypeSpecifier) declSpecifier).getName();
checkClassConstructor(constructorName);
}
}
- }
- // Looking for direct class constructor call and check it.
- else if (expression instanceof ICPPASTFunctionCallExpression) {
- ICPPASTFunctionCallExpression functionCall = (ICPPASTFunctionCallExpression)expression;
+ } else if (expression instanceof ICPPASTFunctionCallExpression) {
+ // Direct constructor call.
+ ICPPASTFunctionCallExpression functionCall = (ICPPASTFunctionCallExpression) expression;
IASTExpression functionName = functionCall.getFunctionNameExpression();
if (functionName instanceof IASTIdExpression) {
- IASTName constructorName = ((IASTIdExpression)functionName).getName();
+ IASTName constructorName = ((IASTIdExpression) functionName).getName();
checkClassConstructor(constructorName);
}
}
@@ -153,10 +152,9 @@ public class AbstractClassInstantiationChecker extends AbstractIndexAstChecker {
IBinding binding = constructorName.resolveBinding();
if (binding instanceof ICPPConstructor) {
// Resolve class and check whether it is abstract.
- reportProblemsIfAbstract(((ICPPConstructor)binding).getClassOwner(), constructorName);
- }
- else if (binding instanceof IType) {
- reportProblemsIfAbstract((IType)binding, constructorName);
+ reportProblemsIfAbstract(((ICPPConstructor) binding).getClassOwner(), constructorName);
+ } else if (binding instanceof IType) {
+ reportProblemsIfAbstract((IType) binding, constructorName);
}
}
@@ -187,7 +185,7 @@ public class AbstractClassInstantiationChecker extends AbstractIndexAstChecker {
private void reportProblemsIfAbstract(IType typeToCheck, IASTNode problemNode ) {
IType unwindedType = CxxAstUtils.getInstance().unwindTypedef(typeToCheck);
if (unwindedType instanceof ICPPClassType) {
- ICPPClassType classType = (ICPPClassType)unwindedType;
+ ICPPClassType classType = (ICPPClassType) unwindedType;
ICPPMethod[] pureVirtualMethods;
if (pureVirtualMethodsCache.containsKey(classType)) {
pureVirtualMethods = pureVirtualMethodsCache.get(classType);

Back to the top