mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Cosmetics.
This commit is contained in:
parent
149937682f
commit
06bcfad238
4 changed files with 33 additions and 57 deletions
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -23,25 +23,25 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
|
||||||
* An example is GCC built-in functions.
|
* An example is GCC built-in functions.
|
||||||
*/
|
*/
|
||||||
public class CPPImplicitFunction extends CPPFunction {
|
public class CPPImplicitFunction extends CPPFunction {
|
||||||
|
private ICPPParameter[] parms;
|
||||||
private ICPPParameter[] parms=null;
|
private IScope scope;
|
||||||
private IScope scope=null;
|
private ICPPFunctionType functionType;
|
||||||
private ICPPFunctionType functionType=null;
|
|
||||||
private final boolean takesVarArgs;
|
private final boolean takesVarArgs;
|
||||||
private boolean isDeleted;
|
private boolean isDeleted;
|
||||||
private final char[] name;
|
private final char[] name;
|
||||||
|
|
||||||
public CPPImplicitFunction(char[] name, IScope scope, ICPPFunctionType type, ICPPParameter[] parms, boolean takesVarArgs) {
|
public CPPImplicitFunction(char[] name, IScope scope, ICPPFunctionType type,
|
||||||
super( null );
|
ICPPParameter[] parms, boolean takesVarArgs) {
|
||||||
this.name=name;
|
super(null);
|
||||||
this.scope=scope;
|
this.name= name;
|
||||||
|
this.scope= scope;
|
||||||
this.functionType= type;
|
this.functionType= type;
|
||||||
this.parms=parms;
|
this.parms= parms;
|
||||||
this.takesVarArgs=takesVarArgs;
|
this.takesVarArgs= takesVarArgs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPParameter [] getParameters() {
|
public ICPPParameter[] getParameters() {
|
||||||
return parms;
|
return parms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,27 +52,19 @@ public class CPPImplicitFunction extends CPPFunction {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return String.valueOf( name );
|
return String.valueOf(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getNameCharArray()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public char[] getNameCharArray() {
|
public char[] getNameCharArray() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getScope()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IScope getScope() {
|
public IScope getScope() {
|
||||||
return scope;
|
return scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IFunction#getFunctionScope()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IScope getFunctionScope() {
|
public IScope getFunctionScope() {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -61,17 +61,18 @@ public class CPPImplicitMethod extends CPPImplicitFunction implements ICPPMethod
|
||||||
}
|
}
|
||||||
if (parent instanceof IASTCompositeTypeSpecifier) {
|
if (parent instanceof IASTCompositeTypeSpecifier) {
|
||||||
IASTCompositeTypeSpecifier cls = (IASTCompositeTypeSpecifier) decl.getParent();
|
IASTCompositeTypeSpecifier cls = (IASTCompositeTypeSpecifier) decl.getParent();
|
||||||
IASTDeclaration [] members = cls.getMembers();
|
IASTDeclaration[] members = cls.getMembers();
|
||||||
ICPPASTVisibilityLabel vis = null;
|
ICPPASTVisibilityLabel vis = null;
|
||||||
for (IASTDeclaration member : members) {
|
for (IASTDeclaration member : members) {
|
||||||
if( member instanceof ICPPASTVisibilityLabel )
|
if (member instanceof ICPPASTVisibilityLabel) {
|
||||||
vis = (ICPPASTVisibilityLabel) member;
|
vis = (ICPPASTVisibilityLabel) member;
|
||||||
else if( member == decl )
|
} else if (member == decl) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if( vis != null ){
|
if (vis != null) {
|
||||||
return vis.getVisibility();
|
return vis.getVisibility();
|
||||||
} else if( cls.getKey() == ICPPASTCompositeTypeSpecifier.k_class ){
|
} else if (cls.getKey() == ICPPASTCompositeTypeSpecifier.k_class) {
|
||||||
return ICPPASTVisibilityLabel.v_private;
|
return ICPPASTVisibilityLabel.v_private;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,7 +81,7 @@ public class CPPImplicitMethod extends CPPImplicitFunction implements ICPPMethod
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPClassType getClassOwner() {
|
public ICPPClassType getClassOwner() {
|
||||||
ICPPClassScope scope = (ICPPClassScope)getScope();
|
ICPPClassScope scope = (ICPPClassScope) getScope();
|
||||||
return scope.getClassType();
|
return scope.getClassType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,8 +168,8 @@ public class CPPImplicitMethod extends CPPImplicitFunction implements ICPPMethod
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDestructor() {
|
public boolean isDestructor() {
|
||||||
char [] n = getNameCharArray();
|
char[] n = getNameCharArray();
|
||||||
if( n != null && n.length > 0 )
|
if (n != null && n.length > 0)
|
||||||
return n[0] == '~';
|
return n[0] == '~';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,8 +131,8 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
|
||||||
dtor= ASTQueries.findInnermostDeclarator(dtor);
|
dtor= ASTQueries.findInnermostDeclarator(dtor);
|
||||||
IASTName name= dtor.getName();
|
IASTName name= dtor.getName();
|
||||||
if (name instanceof ICPPASTQualifiedName) {
|
if (name instanceof ICPPASTQualifiedName) {
|
||||||
IASTName[] ns = ((ICPPASTQualifiedName)name).getNames();
|
IASTName[] ns = ((ICPPASTQualifiedName) name).getNames();
|
||||||
name = ns[ ns.length - 1 ];
|
name = ns[ns.length - 1];
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
@ -142,9 +142,6 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
|
||||||
return CPPVisitor.getContainingScope(getASTName());
|
return CPPVisitor.getContainingScope(getASTName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isVirtual()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVirtual() {
|
public boolean isVirtual() {
|
||||||
IASTDeclaration decl = getPrimaryDeclaration();
|
IASTDeclaration decl = getPrimaryDeclaration();
|
||||||
|
@ -167,9 +164,6 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
|
||||||
return declSpec;
|
return declSpec;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction#isInline()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isInline() {
|
public boolean isInline() {
|
||||||
IASTDeclaration decl = getPrimaryDeclaration();
|
IASTDeclaration decl = getPrimaryDeclaration();
|
||||||
|
@ -182,9 +176,6 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
|
||||||
return declSpec.isInline();
|
return declSpec.isInline();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction#isMutable()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMutable() {
|
public boolean isMutable() {
|
||||||
return hasStorageClass(this, IASTDeclSpecifier.sc_mutable);
|
return hasStorageClass(this, IASTDeclSpecifier.sc_mutable);
|
||||||
|
@ -202,9 +193,6 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isDestructor()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDestructor() {
|
public boolean isDestructor() {
|
||||||
char[] name = getNameCharArray();
|
char[] name = getNameCharArray();
|
||||||
|
@ -219,9 +207,6 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isPureVirtual()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPureVirtual() {
|
public boolean isPureVirtual() {
|
||||||
ICPPASTFunctionDeclarator declarator = findFunctionDeclarator();
|
ICPPASTFunctionDeclarator declarator = findFunctionDeclarator();
|
||||||
|
|
|
@ -12,9 +12,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom;
|
package org.eclipse.cdt.internal.core.pdom.dom;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.Modifier;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
|
@ -40,6 +37,9 @@ import org.eclipse.cdt.internal.core.pdom.db.IString;
|
||||||
import org.eclipse.cdt.internal.core.pdom.tag.PDOMTaggable;
|
import org.eclipse.cdt.internal.core.pdom.tag.PDOMTaggable;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.Modifier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for bindings in the PDOM.
|
* Base class for bindings in the PDOM.
|
||||||
*/
|
*/
|
||||||
|
@ -255,11 +255,9 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IPDOMBinding
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
abstract protected int getRecordSize(); // superclass's implementation is no longer valid
|
abstract protected int getRecordSize(); // Superclass's implementation is no longer valid
|
||||||
|
|
||||||
/* For debug purposes only.
|
/** For debug purposes only. */
|
||||||
* @see java.lang.Object#toString()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public final String toString() {
|
public final String toString() {
|
||||||
String name = toStringBase();
|
String name = toStringBase();
|
||||||
|
@ -300,9 +298,9 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IPDOMBinding
|
||||||
return field.getName();
|
return field.getName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IllegalAccessException iae) {
|
} catch (IllegalAccessException e) {
|
||||||
continue;
|
continue;
|
||||||
} catch (IllegalArgumentException iae) {
|
} catch (IllegalArgumentException e) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue