1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-09 09:15:38 +02:00

Bug 316309: fixing void return typedef in C++ (patch from Marc-Andre Laperle)

This commit is contained in:
Alena Laskavaia 2010-07-29 02:03:55 +00:00
parent dfaf2d0103
commit fbdb55c7a7

View file

@ -26,6 +26,7 @@ import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration; import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator; import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition; import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
import org.eclipse.cdt.core.dom.ast.IASTNamedTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTReturnStatement; import org.eclipse.cdt.core.dom.ast.IASTReturnStatement;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier; import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTStatement; import org.eclipse.cdt.core.dom.ast.IASTStatement;
@ -33,7 +34,6 @@ import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier; import org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.c.ICASTTypedefNameSpecifier;
/** /**
* The checker suppose to find issue related to mismatched return value/function * The checker suppose to find issue related to mismatched return value/function
@ -189,8 +189,8 @@ public class ReturnChecker extends AbstractAstFunctionChecker {
int type = -1; int type = -1;
if (declSpecifier instanceof IASTSimpleDeclSpecifier) { if (declSpecifier instanceof IASTSimpleDeclSpecifier) {
type = ((IASTSimpleDeclSpecifier) declSpecifier).getType(); type = ((IASTSimpleDeclSpecifier) declSpecifier).getType();
} else if (declSpecifier instanceof ICASTTypedefNameSpecifier) { } else if (declSpecifier instanceof IASTNamedTypeSpecifier) {
IBinding binding = ((ICASTTypedefNameSpecifier) declSpecifier) IBinding binding = ((IASTNamedTypeSpecifier) declSpecifier)
.getName().resolveBinding(); .getName().resolveBinding();
IType utype = CxxAstUtils.getInstance().unwindTypedef( IType utype = CxxAstUtils.getInstance().unwindTypedef(
(IType) binding); (IType) binding);