Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CFunctionType.java')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CFunctionType.java114
1 files changed, 57 insertions, 57 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CFunctionType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CFunctionType.java
index 84df107de21..37b433cb9bc 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CFunctionType.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CFunctionType.java
@@ -23,71 +23,72 @@ import org.eclipse.cdt.internal.core.dom.parser.ITypeMarshalBuffer;
import org.eclipse.core.runtime.CoreException;
public class CFunctionType implements IFunctionType, ISerializableType {
- private final IType[] parameters;
- private final IType returnType;
- private final boolean takesVarargs;
+ private final IType[] parameters;
+ private final IType returnType;
+ private final boolean takesVarargs;
- public CFunctionType(IType returnType, IType[] parameters) {
- this(returnType, parameters, false);
- }
+ public CFunctionType(IType returnType, IType[] parameters) {
+ this(returnType, parameters, false);
+ }
- public CFunctionType(IType returnType, IType[] parameters, boolean takesVarargs) {
- this.returnType = returnType;
- this.parameters = parameters;
- this.takesVarargs = takesVarargs;
- }
+ public CFunctionType(IType returnType, IType[] parameters, boolean takesVarargs) {
+ this.returnType = returnType;
+ this.parameters = parameters;
+ this.takesVarargs = takesVarargs;
+ }
- @Override
+ @Override
public boolean isSameType(IType o) {
- if (o == this)
- return true;
- if (o instanceof ITypedef)
- return o.isSameType(this);
- if (o instanceof IFunctionType) {
- IFunctionType ft = (IFunctionType) o;
- IType[] fps;
- fps = ft.getParameterTypes();
- if (fps.length != parameters.length)
- return false;
- if (!returnType.isSameType(ft.getReturnType()))
- return false;
- for (int i = 0; i < parameters.length; i++) {
- if (!parameters[i].isSameType(fps[i]))
- return false;
- }
- return true;
- }
- return false;
- }
+ if (o == this)
+ return true;
+ if (o instanceof ITypedef)
+ return o.isSameType(this);
+ if (o instanceof IFunctionType) {
+ IFunctionType ft = (IFunctionType) o;
+ IType[] fps;
+ fps = ft.getParameterTypes();
+ if (fps.length != parameters.length)
+ return false;
+ if (!returnType.isSameType(ft.getReturnType()))
+ return false;
+ for (int i = 0; i < parameters.length; i++) {
+ if (!parameters[i].isSameType(fps[i]))
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
- @Override
+ @Override
public IType getReturnType() {
- return returnType;
- }
+ return returnType;
+ }
- @Override
+ @Override
public IType[] getParameterTypes() {
- return parameters;
- }
+ return parameters;
+ }
- @Override
+ @Override
public Object clone() {
- IType t = null;
- try {
- t = (IType) super.clone();
- } catch (CloneNotSupportedException e) {
- //not going to happen
- }
- return t;
- }
+ IType t = null;
+ try {
+ t = (IType) super.clone();
+ } catch (CloneNotSupportedException e) {
+ //not going to happen
+ }
+ return t;
+ }
@Override
public void marshal(ITypeMarshalBuffer buffer) throws CoreException {
short firstBytes = ITypeMarshalBuffer.FUNCTION_TYPE;
- if (takesVarargs) firstBytes |= ITypeMarshalBuffer.FLAG1;
+ if (takesVarargs)
+ firstBytes |= ITypeMarshalBuffer.FLAG1;
- int len= parameters.length & 0xffff;
- int codedLen= len * ITypeMarshalBuffer.FLAG2;
+ int len = parameters.length & 0xffff;
+ int codedLen = len * ITypeMarshalBuffer.FLAG2;
if (codedLen < ITypeMarshalBuffer.LAST_FLAG) {
firstBytes |= codedLen;
buffer.putShort(firstBytes);
@@ -106,17 +107,16 @@ public class CFunctionType implements IFunctionType, ISerializableType {
public static IType unmarshal(short firstBytes, ITypeMarshalBuffer buffer) throws CoreException {
int len;
if (((firstBytes & ITypeMarshalBuffer.LAST_FLAG) != 0)) {
- len= buffer.getInt();
+ len = buffer.getInt();
} else {
- len= (firstBytes & (ITypeMarshalBuffer.LAST_FLAG - 1)) / ITypeMarshalBuffer.FLAG2;
+ len = (firstBytes & (ITypeMarshalBuffer.LAST_FLAG - 1)) / ITypeMarshalBuffer.FLAG2;
}
- IType rt= buffer.unmarshalType();
- IType[] pars= new IType[len];
+ IType rt = buffer.unmarshalType();
+ IType[] pars = new IType[len];
for (int i = 0; i < pars.length; i++) {
- pars[i]= buffer.unmarshalType();
+ pars[i] = buffer.unmarshalType();
}
- return new CFunctionType(rt, pars,
- (firstBytes & ITypeMarshalBuffer.FLAG1) != 0); // takes varargs
+ return new CFunctionType(rt, pars, (firstBytes & ITypeMarshalBuffer.FLAG1) != 0); // takes varargs
}
@Override

Back to the top