1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

fixed reporting of error in empty constructor

This commit is contained in:
Alena Laskavaia 2011-05-02 02:18:23 +00:00
parent 36843b8c72
commit 38bd4a6094

View file

@ -96,7 +96,7 @@ public class ReturnChecker extends AbstractAstFunctionChecker {
if (hasret == false && hasValue) {
hasret = true;
}
if (!isVoid(func) && !isConstructorDestructor()) {
if (!isVoid(func) && !isConstructorDestructor(func)) {
if (checkImplicitReturn(RET_NO_VALUE_ID) || isExplicitReturn(func)) {
if (!hasValue)
reportProblem(RET_NO_VALUE_ID, ret);
@ -113,20 +113,21 @@ public class ReturnChecker extends AbstractAstFunctionChecker {
}
return PROCESS_CONTINUE;
}
}
/**
* @return
*
*/
public boolean isConstructorDestructor() {
if (func instanceof ICPPASTFunctionDefinition) {
IBinding method = func.getDeclarator().getName().resolveBinding();
if (method instanceof ICPPConstructor || method instanceof ICPPMethod && ((ICPPMethod) method).isDestructor()) {
return true;
}
/**
* @param func
* @return
*
*/
public boolean isConstructorDestructor(IASTFunctionDefinition func) {
if (func instanceof ICPPASTFunctionDefinition) {
IBinding method = func.getDeclarator().getName().resolveBinding();
if (method instanceof ICPPConstructor || method instanceof ICPPMethod && ((ICPPMethod) method).isDestructor()) {
return true;
}
return false;
}
return false;
}
/*
@ -157,7 +158,8 @@ public class ReturnChecker extends AbstractAstFunctionChecker {
reportNoRet(func, visitor.hasret);
}
} else {
reportNoRet(func, false);
reportNoRet(func, false);
}
}
}
@ -172,6 +174,9 @@ public class ReturnChecker extends AbstractAstFunctionChecker {
if (checkImplicitReturn(RET_NORET_ID) == false && isExplicitReturn(func) == false) {
return;
}
if (isConstructorDestructor(func)) {
return;
}
}
reportProblem(RET_NORET_ID, func.getDeclSpecifier());
}