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

Cosmetics.

This commit is contained in:
Sergey Prigogin 2012-05-30 16:22:23 -07:00
parent 224b4ef3a3
commit 3604f812ce
18 changed files with 2296 additions and 2371 deletions

View file

@ -376,9 +376,10 @@ public class AST2BaseTest extends BaseTestCase {
protected void assertInstances(CPPNameCollector collector, IBinding binding, int num) throws Exception { protected void assertInstances(CPPNameCollector collector, IBinding binding, int num) throws Exception {
int count = 0; int count = 0;
for (int i = 0; i < collector.size(); i++) for (int i = 0; i < collector.size(); i++) {
if (collector.getName(i).resolveBinding() == binding) if (collector.getName(i).resolveBinding() == binding)
count++; count++;
}
assertEquals(num, count); assertEquals(num, count);
} }

View file

@ -127,7 +127,6 @@ import org.eclipse.cdt.internal.core.parser.ParserException;
* Testcases on the AST. * Testcases on the AST.
*/ */
public class AST2Tests extends AST2BaseTest { public class AST2Tests extends AST2BaseTest {
private static final int NUM_TESTS = 3; private static final int NUM_TESTS = 3;
public static TestSuite suite() { public static TestSuite suite() {
@ -2229,18 +2228,12 @@ public class AST2Tests extends AST2BaseTest {
assertTrue(tu.isFrozen()); assertTrue(tu.isFrozen());
for (int i = 0; i < NUM_TESTS; i++) { for (int i = 0; i < NUM_TESTS; i++) {
IASTFunctionDefinition def1 = (IASTFunctionDefinition) tu IASTFunctionDefinition def1 = (IASTFunctionDefinition) tu.getDeclarations()[0];
.getDeclarations()[0]; IFunction f = (IFunction) def1.getDeclarator().getName().resolveBinding();
IFunction f = (IFunction) def1.getDeclarator().getName() IASTFunctionDefinition def2 = (IASTFunctionDefinition) tu.getDeclarations()[1];
.resolveBinding(); IFunction f2 = (IFunction) def2.getDeclarator().getName().resolveBinding();
IASTFunctionDefinition def2 = (IASTFunctionDefinition) tu IASTFunctionDefinition def3 = (IASTFunctionDefinition) tu.getDeclarations()[2];
.getDeclarations()[1]; IFunction f3 = (IFunction) def3.getDeclarator().getName().resolveBinding();
IFunction f2 = (IFunction) def2.getDeclarator().getName()
.resolveBinding();
IASTFunctionDefinition def3 = (IASTFunctionDefinition) tu
.getDeclarations()[2];
IFunction f3 = (IFunction) def3.getDeclarator().getName()
.resolveBinding();
IFunctionType ft = f.getType(); IFunctionType ft = f.getType();
IFunctionType ft2 = f2.getType(); IFunctionType ft2 = f2.getType();
@ -2251,17 +2244,15 @@ public class AST2Tests extends AST2BaseTest {
assertTrue(((IPointerType) ft2.getReturnType()).getType() instanceof IBasicType); assertTrue(((IPointerType) ft2.getReturnType()).getType() instanceof IBasicType);
assertTrue(ft3.getReturnType() instanceof IPointerType); assertTrue(ft3.getReturnType() instanceof IPointerType);
assertTrue(((IPointerType) ft3.getReturnType()).getType() instanceof IFunctionType); assertTrue(((IPointerType) ft3.getReturnType()).getType() instanceof IFunctionType);
assertTrue(((IFunctionType) ((IPointerType) ft3.getReturnType()) assertTrue(((IFunctionType) ((IPointerType) ft3.getReturnType()).getType()).getReturnType()
.getType()).getReturnType() instanceof IBasicType); instanceof IBasicType);
// test tu.getDeclarationsInAST(IBinding) // test tu.getDeclarationsInAST(IBinding)
IASTName[] decls = tu.getDeclarationsInAST(def1.getDeclarator().getName() IASTName[] decls = tu.getDeclarationsInAST(def1.getDeclarator().getName().resolveBinding());
.resolveBinding());
assertEquals(decls.length, 1); assertEquals(decls.length, 1);
assertEquals(decls[0], def1.getDeclarator().getName()); assertEquals(decls[0], def1.getDeclarator().getName());
decls = tu.getDeclarationsInAST(def2.getDeclarator().getName() decls = tu.getDeclarationsInAST(def2.getDeclarator().getName().resolveBinding());
.resolveBinding());
assertEquals(decls.length, 1); assertEquals(decls.length, 1);
assertEquals(decls[0], def2.getDeclarator().getName()); assertEquals(decls[0], def2.getDeclarator().getName());
@ -2276,8 +2267,7 @@ public class AST2Tests extends AST2BaseTest {
// any parameter to type function returning T is adjusted to be pointer to // any parameter to type function returning T is adjusted to be pointer to
// function returning T // function returning T
public void testParmToFunction() throws Exception { public void testParmToFunction() throws Exception {
IASTTranslationUnit tu = parse( IASTTranslationUnit tu = parse("int f(int g(void)) { return g();}", ParserLanguage.C);
"int f(int g(void)) { return g();}", ParserLanguage.C); //$NON-NLS-1$
assertTrue(tu.isFrozen()); assertTrue(tu.isFrozen());
for (int i = 0; i < NUM_TESTS; i++) { for (int i = 0; i < NUM_TESTS; i++) {
IASTFunctionDefinition def = (IASTFunctionDefinition) tu.getDeclarations()[0]; IASTFunctionDefinition def = (IASTFunctionDefinition) tu.getDeclarations()[0];
@ -2300,7 +2290,8 @@ public class AST2Tests extends AST2BaseTest {
assertTrue(def.getDeclarator() instanceof IASTStandardFunctionDeclarator); assertTrue(def.getDeclarator() instanceof IASTStandardFunctionDeclarator);
IASTName name_g = ((IASTStandardFunctionDeclarator) def.getDeclarator()) IASTName name_g = ((IASTStandardFunctionDeclarator) def.getDeclarator())
.getParameters()[0].getDeclarator().getName(); .getParameters()[0].getDeclarator().getName();
IASTName name_g_call = ((IASTIdExpression) ((IASTFunctionCallExpression) ((IASTReturnStatement) ((IASTCompoundStatement) def IASTName name_g_call =
((IASTIdExpression) ((IASTFunctionCallExpression) ((IASTReturnStatement) ((IASTCompoundStatement) def
.getBody()).getStatements()[0]).getReturnValue()) .getBody()).getStatements()[0]).getReturnValue())
.getFunctionNameExpression()).getName(); .getFunctionNameExpression()).getName();
IASTName[] decls = tu.getDeclarationsInAST(name_g_call.resolveBinding()); IASTName[] decls = tu.getDeclarationsInAST(name_g_call.resolveBinding());
@ -2312,15 +2303,13 @@ public class AST2Tests extends AST2BaseTest {
} }
public void testArrayPointerFunction() throws Exception { public void testArrayPointerFunction() throws Exception {
IASTTranslationUnit tu = parse( IASTTranslationUnit tu = parse("int (*v[])(int *x, int *y);", ParserLanguage.C);
"int (*v[])(int *x, int *y);", ParserLanguage.C); //$NON-NLS-1$
assertTrue(tu.isFrozen()); assertTrue(tu.isFrozen());
for (int i = 0; i < NUM_TESTS; i++) { for (int i = 0; i < NUM_TESTS; i++) {
IASTSimpleDeclaration decl = (IASTSimpleDeclaration) tu.getDeclarations()[0]; IASTSimpleDeclaration decl = (IASTSimpleDeclaration) tu.getDeclarations()[0];
IVariable v = (IVariable) ((IASTStandardFunctionDeclarator) decl IVariable v = (IVariable) ((IASTStandardFunctionDeclarator) decl.getDeclarators()[0])
.getDeclarators()[0]).getNestedDeclarator().getName() .getNestedDeclarator().getName().resolveBinding();
.resolveBinding();
IType vt_1 = v.getType(); IType vt_1 = v.getType();
assertTrue(vt_1 instanceof IArrayType); assertTrue(vt_1 instanceof IArrayType);
@ -2348,8 +2337,8 @@ public class AST2Tests extends AST2BaseTest {
.getDeclarators()[0]).getNestedDeclarator().getName() .getDeclarators()[0]).getNestedDeclarator().getName()
.resolveBinding()); .resolveBinding());
assertEquals(decls.length, 1); assertEquals(decls.length, 1);
assertEquals(decls[0], ((IASTStandardFunctionDeclarator) decl assertEquals(decls[0], ((IASTStandardFunctionDeclarator) decl.getDeclarators()[0])
.getDeclarators()[0]).getNestedDeclarator().getName()); .getNestedDeclarator().getName());
tu = validateCopy(tu); tu = validateCopy(tu);
} }
@ -2396,8 +2385,8 @@ public class AST2Tests extends AST2BaseTest {
assertEquals(decls.length, 1); assertEquals(decls.length, 1);
assertEquals(decls[0], name_DWORD); assertEquals(decls[0], name_DWORD);
decls = tu.getDeclarationsInAST(((IASTNamedTypeSpecifier) decl2 decls = tu.getDeclarationsInAST(((IASTNamedTypeSpecifier) decl2.getDeclSpecifier())
.getDeclSpecifier()).getName().resolveBinding()); .getName().resolveBinding());
assertEquals(decls.length, 1); assertEquals(decls.length, 1);
assertEquals(decls[0], name_DWORD); assertEquals(decls[0], name_DWORD);
@ -7347,7 +7336,6 @@ public class AST2Tests extends AST2BaseTest {
assertFalse(((IASTPreprocessorIfdefStatement) stmts[1]).taken()); assertFalse(((IASTPreprocessorIfdefStatement) stmts[1]).taken());
} }
// void a() { // void a() {
// typedef float size_t; // typedef float size_t;
// sizeof(10); // wrong - getExpressionType returns float // sizeof(10); // wrong - getExpressionType returns float

View file

@ -13,8 +13,8 @@ package org.eclipse.cdt.core.settings.model.extension;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
public abstract class CLanguageData extends CDataObject { public abstract class CLanguageData extends CDataObject {
protected CLanguageData() {
protected CLanguageData() {
} }
// public abstract CDataObject[] getChildrenOfKind(int kind); // public abstract CDataObject[] getChildrenOfKind(int kind);

View file

@ -328,7 +328,6 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
* This occurs during the SetCProjectDescription Operation * This occurs during the SetCProjectDescription Operation
*/ */
void switchToCachedConfigurationDescriptions() throws CoreException { void switchToCachedConfigurationDescriptions() throws CoreException {
for (Map.Entry<String, ICConfigurationDescription> e : fCfgMap.entrySet()) { for (Map.Entry<String, ICConfigurationDescription> e : fCfgMap.entrySet()) {
if (e.getValue() instanceof CConfigurationDescription) { if (e.getValue() instanceof CConfigurationDescription) {
CConfigurationDescription cfgDes = (CConfigurationDescription) e.getValue(); CConfigurationDescription cfgDes = (CConfigurationDescription) e.getValue();
@ -401,7 +400,6 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
if (cfgDes != null) { if (cfgDes != null) {
cfgDes.removeConfiguration(); cfgDes.removeConfiguration();
} }
} }
void configurationRemoved(CConfigurationDescription des) { void configurationRemoved(CConfigurationDescription des) {
@ -432,7 +430,6 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
if (getConfigurationRelations() == CONFIGS_LINK_SETTINGS_AND_ACTIVE) if (getConfigurationRelations() == CONFIGS_LINK_SETTINGS_AND_ACTIVE)
fSettingCfgInfo.setConfiguration(cfg); fSettingCfgInfo.setConfiguration(cfg);
} }
@Override @Override
@ -559,9 +556,10 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
if (fStorage.isModified()) if (fStorage.isModified())
return true; return true;
for(ICConfigurationDescription cfgDes : fCfgMap.values()) for (ICConfigurationDescription cfgDes : fCfgMap.values()) {
if (cfgDes.isModified()) if (cfgDes.isModified())
return true; return true;
}
return false; return false;
} }
@ -641,10 +639,11 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
@Override @Override
public void setSessionProperty(QualifiedName name, Object value) { public void setSessionProperty(QualifiedName name, Object value) {
if(value != null) if (value != null) {
fPropertiesMap.put(name, value); fPropertiesMap.put(name, value);
else } else {
fPropertiesMap.remove(name); fPropertiesMap.remove(name);
}
fIsModified = true; fIsModified = true;
} }
@ -735,6 +734,4 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
fIsModified = true; fIsModified = true;
} }
} }

View file

@ -20,7 +20,6 @@ package org.eclipse.cdt.core.dom.ast;
* @since 5.0 * @since 5.0
*/ */
public interface IASTNodeSelector { public interface IASTNodeSelector {
/** /**
* Returns the name for the exact given range, or <code>null</code> if there is no such node. * Returns the name for the exact given range, or <code>null</code> if there is no such node.
* Will not return an implicit name. * Will not return an implicit name.

View file

@ -22,7 +22,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IType extends Cloneable { public interface IType extends Cloneable {
public static final IType[] EMPTY_TYPE_ARRAY = new IType[0]; public static final IType[] EMPTY_TYPE_ARRAY = {};
public static final ASTTypeMatcher TYPE_MATCHER = new ASTTypeMatcher(); public static final ASTTypeMatcher TYPE_MATCHER = new ASTTypeMatcher();
public Object clone(); public Object clone();

View file

@ -15,7 +15,6 @@ package org.eclipse.cdt.core.dom.ast;
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ITypedef extends IBinding, IType { public interface ITypedef extends IBinding, IType {
/** /**
* Returns the type that this thing is a typedef of * Returns the type that this thing is a typedef of
*/ */

View file

@ -19,9 +19,8 @@ import org.eclipse.cdt.core.dom.ast.IType;
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPPointerToMemberType extends IPointerType { public interface ICPPPointerToMemberType extends IPointerType {
/** /**
* Get the class to whose members this points to. * Returns the class to whose members this points to.
* @return Either ICPPClassType or ICPPTeplateTypeParameter. * @return Either ICPPClassType or ICPPTeplateTypeParameter.
*/ */
public IType getMemberOfClass(); public IType getMemberOfClass();

View file

@ -190,7 +190,8 @@ public abstract class ArithmeticConversion {
return signedType; return signedType;
} }
return createBasicType(signedType.getKind(), changeModifier(signedType.getModifiers(), IBasicType.IS_SIGNED, IBasicType.IS_UNSIGNED)); return createBasicType(signedType.getKind(),
changeModifier(signedType.getModifiers(), IBasicType.IS_SIGNED, IBasicType.IS_UNSIGNED));
} }
private IBasicType promote(IType type, Domain domain) { private IBasicType promote(IType type, Domain domain) {

View file

@ -54,11 +54,7 @@ public class CASTBinaryExpression extends ASTNode
copy.op = op; copy.op = op;
copy.setOperand1(operand1 == null ? null : operand1.copy(style)); copy.setOperand1(operand1 == null ? null : operand1.copy(style));
copy.setOperand2(operand2 == null ? null : operand2.copy(style)); copy.setOperand2(operand2 == null ? null : operand2.copy(style));
copy.setOffsetAndLength(this); return copy(copy, style);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
} }
@Override @Override

View file

@ -30,7 +30,6 @@ public class CASTUnaryExpression extends ASTNode implements IASTUnaryExpression,
private int operator; private int operator;
private IASTExpression operand; private IASTExpression operand;
public CASTUnaryExpression() { public CASTUnaryExpression() {
} }
@ -46,13 +45,9 @@ public class CASTUnaryExpression extends ASTNode implements IASTUnaryExpression,
@Override @Override
public CASTUnaryExpression copy(CopyStyle style) { public CASTUnaryExpression copy(CopyStyle style) {
CASTUnaryExpression copy = new CASTUnaryExpression(operator, operand == null ? null CASTUnaryExpression copy =
: operand.copy(style)); new CASTUnaryExpression(operator, operand == null ? null : operand.copy(style));
copy.setOffsetAndLength(this); return copy(copy, style);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
} }
@Override @Override
@ -91,7 +86,7 @@ public class CASTUnaryExpression extends ASTNode implements IASTUnaryExpression,
} }
} }
if( operand != null ) if( !operand.accept( action ) ) return false; if (operand != null && !operand.accept(action)) return false;
if (action.shouldVisitExpressions) { if (action.shouldVisitExpressions) {
switch (action.leave(this)) { switch (action.leave(this)) {
@ -105,8 +100,7 @@ public class CASTUnaryExpression extends ASTNode implements IASTUnaryExpression,
@Override @Override
public void replace(IASTNode child, IASTNode other) { public void replace(IASTNode child, IASTNode other) {
if( child == operand ) if (child == operand) {
{
other.setPropertyInParent(child.getPropertyInParent()); other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent()); other.setParent(child.getParent());
operand = (IASTExpression) other; operand = (IASTExpression) other;

View file

@ -11,8 +11,8 @@
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.IBasicType; import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IBasicType.Kind; import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.internal.core.dom.parser.ArithmeticConversion; import org.eclipse.cdt.internal.core.dom.parser.ArithmeticConversion;
public class CPPArithmeticConversion extends ArithmeticConversion { public class CPPArithmeticConversion extends ArithmeticConversion {

View file

@ -23,9 +23,9 @@ import org.eclipse.cdt.core.dom.ast.ITypedef;
* An example is the GCC built-in typedef: typedef char * __builtin_va_list; * An example is the GCC built-in typedef: typedef char * __builtin_va_list;
*/ */
public class CPPImplicitTypedef extends CPPTypedef { public class CPPImplicitTypedef extends CPPTypedef {
private IType type=null; private IType type;
private char[] name=null; private char[] name;
private IScope scope=null; private IScope scope;
public CPPImplicitTypedef(IType type, char[] name, IScope scope) { public CPPImplicitTypedef(IType type, char[] name, IScope scope) {
super(null); super(null);
@ -135,5 +135,4 @@ public class CPPImplicitTypedef extends CPPTypedef {
public boolean isGloballyQualified() { public boolean isGloballyQualified() {
return true; return true;
} }
} }

View file

@ -38,20 +38,20 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
import org.eclipse.core.runtime.PlatformObject; import org.eclipse.core.runtime.PlatformObject;
/** /**
* Binding for a c++ function parameter * Binding for a c++ function parameter.
*/ */
public class CPPParameter extends PlatformObject implements ICPPParameter, ICPPInternalBinding, ICPPTwoPhaseBinding { public class CPPParameter extends PlatformObject implements ICPPParameter, ICPPInternalBinding, ICPPTwoPhaseBinding {
public static class CPPParameterProblem extends ProblemBinding implements ICPPParameter { public static class CPPParameterProblem extends ProblemBinding implements ICPPParameter {
public CPPParameterProblem(IASTNode node, int id, char[] arg) { public CPPParameterProblem(IASTNode node, int id, char[] arg) {
super(node, id, arg); super(node, id, arg);
} }
} }
private IType fType = null; private IType fType;
private IASTName[] fDeclarations = null; private IASTName[] fDeclarations;
private int fPosition; private int fPosition;
public CPPParameter(IASTName name, int pos) { public CPPParameter(IASTName name, int pos) {
this.fDeclarations = new IASTName[] { name }; this.fDeclarations = new IASTName[] { name };
fPosition= pos; fPosition= pos;
@ -67,17 +67,11 @@ public class CPPParameter extends PlatformObject implements ICPPParameter, ICPPI
return getType() instanceof ICPPParameterPackType; return getType() instanceof ICPPParameterPackType;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPBinding#getDeclarations()
*/
@Override @Override
public IASTNode[] getDeclarations() { public IASTNode[] getDeclarations() {
return fDeclarations; return fDeclarations;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPBinding#getDefinition()
*/
@Override @Override
public IASTNode getDefinition() { public IASTNode getDefinition() {
return null; return null;
@ -121,17 +115,12 @@ public class CPPParameter extends PlatformObject implements ICPPParameter, ICPPI
} }
return null; return null;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
*/
@Override @Override
public String getName() { public String getName() {
return new String(getNameCharArray()); return new String(getNameCharArray());
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBinding#getNameCharArray()
*/
@Override @Override
public char[] getNameCharArray() { public char[] getNameCharArray() {
IASTName name = getPrimaryDeclaration(); IASTName name = getPrimaryDeclaration();
@ -140,26 +129,17 @@ public class CPPParameter extends PlatformObject implements ICPPParameter, ICPPI
return CharArrayUtils.EMPTY; return CharArrayUtils.EMPTY;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBinding#getScope()
*/
@Override @Override
public IScope getScope() { public IScope getScope() {
return CPPVisitor.getContainingScope(getPrimaryDeclaration()); return CPPVisitor.getContainingScope(getPrimaryDeclaration());
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBinding#getPhysicalNode()
*/
public IASTNode getPhysicalNode() { public IASTNode getPhysicalNode() {
if (fDeclarations != null) if (fDeclarations != null)
return fDeclarations[0]; return fDeclarations[0];
return null; return null;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IVariable#getType()
*/
@Override @Override
public IType getType() { public IType getType() {
if (fType == null && fDeclarations != null) { if (fType == null && fDeclarations != null) {
@ -175,75 +155,48 @@ public class CPPParameter extends PlatformObject implements ICPPParameter, ICPPI
return fType; return fType;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IVariable#isStatic()
*/
@Override @Override
public boolean isStatic() { public boolean isStatic() {
return false; return false;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBinding#getFullyQualifiedName()
*/
@Override @Override
public String[] getQualifiedName() { public String[] getQualifiedName() {
return new String[] { getName() }; return new String[] { getName() };
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBinding#getFullyQualifiedNameCharArray()
*/
@Override @Override
public char[][] getQualifiedNameCharArray() { public char[][] getQualifiedNameCharArray() {
return new char[][] { getNameCharArray() }; return new char[][] { getNameCharArray() };
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding#isGloballyQualified()
*/
@Override @Override
public boolean isGloballyQualified() { public boolean isGloballyQualified() {
return false; return false;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#addDefinition(org.eclipse.cdt.core.dom.ast.IASTNode)
*/
@Override @Override
public void addDefinition(IASTNode node) { public void addDefinition(IASTNode node) {
addDeclaration(node); addDeclaration(node);
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IVariable#isExtern()
*/
@Override @Override
public boolean isExtern() { public boolean isExtern() {
// 7.1.1-5 extern can not be used in the declaration of a parameter // 7.1.1-5 extern can not be used in the declaration of a parameter
return false; return false;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable#isMutable()
*/
@Override @Override
public boolean isMutable() { public boolean isMutable() {
// 7.1.1-8 mutable can only apply to class members // 7.1.1-8 mutable can only apply to class members
return false; return false;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IVariable#isAuto()
*/
@Override @Override
public boolean isAuto() { public boolean isAuto() {
return hasStorageClass(IASTDeclSpecifier.sc_auto); return hasStorageClass(IASTDeclSpecifier.sc_auto);
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IVariable#isRegister()
*/
@Override @Override
public boolean isRegister() { public boolean isRegister() {
return hasStorageClass(IASTDeclSpecifier.sc_register); return hasStorageClass(IASTDeclSpecifier.sc_register);

View file

@ -35,7 +35,7 @@ public class CPPTypedef extends PlatformObject implements ITypedef, ITypeContain
private IType type; private IType type;
public CPPTypedef(IASTName name) { public CPPTypedef(IASTName name) {
// bug 223020 even though qualified names are not legal, we need to deal with them. // Bug 223020 even though qualified names are not legal, we need to deal with them.
if (name != null && name.getParent() instanceof ICPPASTQualifiedName) { if (name != null && name.getParent() instanceof ICPPASTQualifiedName) {
name= (IASTName) name.getParent(); name= (IASTName) name.getParent();
} }
@ -105,7 +105,7 @@ public class CPPTypedef extends PlatformObject implements ITypedef, ITypeContain
try { try {
t = (IType) super.clone(); t = (IType) super.clone();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
//not going to happen // Not going to happen
} }
return t; return t;
} }

View file

@ -2017,7 +2017,8 @@ public class CPPVisitor extends ASTQueries {
return createAutoType(autoInitClause, declSpec, declarator); return createAutoType(autoInitClause, declSpec, declarator);
} }
private static IType createAutoType(IASTInitializerClause initClause, IASTDeclSpecifier declSpec, IASTDeclarator declarator) { private static IType createAutoType(IASTInitializerClause initClause, IASTDeclSpecifier declSpec,
IASTDeclarator declarator) {
// C++0x: 7.1.6.4 // C++0x: 7.1.6.4
if (initClause == null || !autoTypeDeclSpecs.get().add(declSpec)) { if (initClause == null || !autoTypeDeclSpecs.get().add(declSpec)) {
// Detected a self referring auto type, e.g.: auto x = x; // Detected a self referring auto type, e.g.: auto x = x;

View file

@ -26,7 +26,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
/** /**
* Methods for computing the type of an expression * Methods for computing the type of an expression
*/ */
@ -41,7 +40,6 @@ public class ExpressionTypes {
return Conversions.lvalue_to_rvalue(type); return Conversions.lvalue_to_rvalue(type);
} }
public static ValueCategory valueCategoryFromFunctionCall(ICPPFunction function) { public static ValueCategory valueCategoryFromFunctionCall(ICPPFunction function) {
final ICPPFunctionType ft = function.getType(); final ICPPFunctionType ft = function.getType();
return valueCategoryFromReturnType(ft.getReturnType()); return valueCategoryFromReturnType(ft.getReturnType());