Skip to main content
summaryrefslogtreecommitdiffstats
path: root/codan
diff options
context:
space:
mode:
authorAlena Laskavaia2010-06-16 20:27:02 -0400
committerAlena Laskavaia2010-06-16 20:27:02 -0400
commitea0d692c81c75782f05e4641890398d84138e09b (patch)
treee203bdd97233336d5123654185e4dfb452ee575c /codan
parent31f7a1fa827c87ffb9721d7c06f0d055cc76ad9b (diff)
downloadorg.eclipse.cdt-ea0d692c81c75782f05e4641890398d84138e09b.tar.gz
org.eclipse.cdt-ea0d692c81c75782f05e4641890398d84138e09b.tar.xz
org.eclipse.cdt-ea0d692c81c75782f05e4641890398d84138e09b.zip
Bug 316309: unwind typedef for void
Diffstat (limited to 'codan')
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java
index e88c86d5f9..420926ed7b 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java
@@ -12,6 +12,7 @@ package org.eclipse.cdt.codan.internal.checkers;
import java.util.Iterator;
+import org.eclipse.cdt.codan.core.cxx.CxxAstUtils;
import org.eclipse.cdt.codan.core.cxx.model.AbstractAstFunctionChecker;
import org.eclipse.cdt.codan.core.cxx.model.CxxModelsCache;
import org.eclipse.cdt.codan.core.model.IProblem;
@@ -29,8 +30,10 @@ import org.eclipse.cdt.core.dom.ast.IASTReturnStatement;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTStatement;
import org.eclipse.cdt.core.dom.ast.IBasicType;
+import org.eclipse.cdt.core.dom.ast.IBinding;
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.ICASTTypedefNameSpecifier;
/**
* The checker suppose to find issue related to mismatched return value/function
@@ -186,6 +189,13 @@ public class ReturnChecker extends AbstractAstFunctionChecker {
int type = -1;
if (declSpecifier instanceof IASTSimpleDeclSpecifier) {
type = ((IASTSimpleDeclSpecifier) declSpecifier).getType();
+ } else if (declSpecifier instanceof ICASTTypedefNameSpecifier) {
+ IBinding binding = ((ICASTTypedefNameSpecifier) declSpecifier)
+ .getName().resolveBinding();
+ IType utype = CxxAstUtils.getInstance().unwindTypedef(
+ (IType) binding);
+ if (isVoid(utype))
+ return IASTSimpleDeclSpecifier.t_void;
}
return type;
}

Back to the top