diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTExpression.java index 724f778076a..fe3238dc101 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTExpression.java @@ -20,7 +20,7 @@ import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate; * @author jcamelon * */ -public interface IASTExpression extends ISourceElementCallbackDelegate, IASTNode +public interface IASTExpression extends ISourceElementCallbackDelegate, IASTNode, IASTOffsetableElement { public class Kind extends Enum { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java index a4fb816be25..c71549c2607 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java @@ -118,7 +118,7 @@ public interface IASTFactory IASTExpression rhs, IASTExpression thirdExpression, IASTTypeId typeId, - ITokenDuple idExpression, char[] literal, IASTNewExpressionDescriptor newDescriptor) throws ASTSemanticException; + ITokenDuple idExpression, char[] literal, IASTNewExpressionDescriptor newDescriptor, ITokenDuple extra) throws ASTSemanticException; public IASTExpression.IASTNewExpressionDescriptor createNewDescriptor(List newPlacementExpressions,List newTypeIdExpressions,List newInitializerExpressions); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/GCCParserExtension.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/GCCParserExtension.java index 2360a8b5afb..3db87a38bb7 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/GCCParserExtension.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/GCCParserExtension.java @@ -171,7 +171,7 @@ public class GCCParserExtension implements IParserExtension { null, null, d, - null, EMPTY_STRING, null); + null, EMPTY_STRING, null, null); } catch (ASTSemanticException e) { @@ -199,7 +199,7 @@ public class GCCParserExtension implements IParserExtension { null, null, null, - null, EMPTY_STRING, null); + null, EMPTY_STRING, null, null); } catch (ASTSemanticException e1) { @@ -374,7 +374,7 @@ public class GCCParserExtension implements IParserExtension { try { IASTExpression resultExpression = data.getAstFactory().createExpression( - scope, expressionKind, lhsExpression, secondExpression, null, null, null, EMPTY_STRING, null ); + scope, expressionKind, lhsExpression, secondExpression, null, null, null, EMPTY_STRING, null, null ); return resultExpression; } catch (ASTSemanticException e1) { data.backup( mark ); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java index 9706420a05d..62ed3f01069 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java @@ -371,7 +371,7 @@ public class Parser implements IParserData, IParser expression = astFactory.createExpression(scope, IASTExpression.Kind.POSTFIX_TYPEID_TYPEID, null, null, - null, typeId, null, EMPTY_STRING, null); + null, typeId, null, EMPTY_STRING, null, null); list.add(expression); completedArg = true; } catch (BacktrackException e) { @@ -404,7 +404,7 @@ public class Parser implements IParserData, IParser KeywordSetKey.EMPTY); expression = astFactory.createExpression(scope, IASTExpression.Kind.ID_EXPRESSION, null, null, - null, null, nameDuple, EMPTY_STRING, null); + null, null, nameDuple, EMPTY_STRING, null, null); list.add(expression); continue; } catch (ASTSemanticException e) { @@ -827,7 +827,7 @@ public class Parser implements IParserData, IParser assignmentExpression = astFactory.createExpression(scope, IASTExpression.Kind.EXPRESSIONLIST, assignmentExpression, secondExpression, null, null, - null, EMPTY_STRING, null); + null, EMPTY_STRING, null, null); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -868,7 +868,7 @@ public class Parser implements IParserData, IParser consume( IToken.tRPAREN ); try { - resultExpression = astFactory.createExpression( scope, extension.getExpressionKindForStatement(), null, null, null, null, null,EMPTY_STRING, null ); + resultExpression = astFactory.createExpression( scope, extension.getExpressionKindForStatement(), null, null, null, null, null,EMPTY_STRING, null, null ); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); @@ -970,7 +970,7 @@ public class Parser implements IParserData, IParser try { return astFactory.createExpression(scope, IASTExpression.Kind.THROWEXPRESSION, throwExpression, null, - null, null, null, EMPTY_STRING, null); + null, null, null, EMPTY_STRING, null, null); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -1006,7 +1006,7 @@ public class Parser implements IParserData, IParser return astFactory.createExpression(scope, IASTExpression.Kind.CONDITIONALEXPRESSION, firstExpression, secondExpression, thirdExpression, - null, null, EMPTY_STRING, null); + null, null, EMPTY_STRING, null, null); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -1038,7 +1038,7 @@ public class Parser implements IParserData, IParser firstExpression = astFactory.createExpression(scope, IASTExpression.Kind.LOGICALOREXPRESSION, firstExpression, secondExpression, null, null, null, - EMPTY_STRING, null); + EMPTY_STRING, null, null); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -1070,7 +1070,7 @@ public class Parser implements IParserData, IParser firstExpression = astFactory.createExpression(scope, IASTExpression.Kind.LOGICALANDEXPRESSION, firstExpression, secondExpression, null, null, null, - EMPTY_STRING, null); + EMPTY_STRING, null, null); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -1103,7 +1103,7 @@ public class Parser implements IParserData, IParser firstExpression = astFactory.createExpression(scope, IASTExpression.Kind.INCLUSIVEOREXPRESSION, firstExpression, secondExpression, null, null, null, - EMPTY_STRING, null); + EMPTY_STRING, null, null); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -1136,7 +1136,7 @@ public class Parser implements IParserData, IParser firstExpression = astFactory.createExpression(scope, IASTExpression.Kind.EXCLUSIVEOREXPRESSION, firstExpression, secondExpression, null, null, null, - EMPTY_STRING, null); + EMPTY_STRING, null, null); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -1168,7 +1168,7 @@ public class Parser implements IParserData, IParser try { firstExpression = astFactory.createExpression(scope, IASTExpression.Kind.ANDEXPRESSION, firstExpression, - secondExpression, null, null, null, EMPTY_STRING, null); + secondExpression, null, null, null, EMPTY_STRING, null, null); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -1226,7 +1226,7 @@ public class Parser implements IParserData, IParser ? IASTExpression.Kind.EQUALITY_EQUALS : IASTExpression.Kind.EQUALITY_NOTEQUALS, firstExpression, secondExpression, null, null, - null, EMPTY_STRING, null); + null, EMPTY_STRING, null, null); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -1293,7 +1293,7 @@ public class Parser implements IParserData, IParser firstExpression = astFactory.createExpression(scope, expressionKind, firstExpression, secondExpression, null, null, null, - EMPTY_STRING, null); + EMPTY_STRING, null, null); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -1341,7 +1341,7 @@ public class Parser implements IParserData, IParser ? IASTExpression.Kind.SHIFT_LEFT : IASTExpression.Kind.SHIFT_RIGHT), firstExpression, secondExpression, null, null, - null, EMPTY_STRING, null); + null, EMPTY_STRING, null, null); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -1382,7 +1382,7 @@ public class Parser implements IParserData, IParser ? IASTExpression.Kind.ADDITIVE_PLUS : IASTExpression.Kind.ADDITIVE_MINUS), firstExpression, secondExpression, null, null, - null, EMPTY_STRING, null); + null, EMPTY_STRING, null, null); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -1434,7 +1434,7 @@ public class Parser implements IParserData, IParser firstExpression = astFactory.createExpression(scope, expressionKind, firstExpression, secondExpression, null, null, null, - EMPTY_STRING, null); + EMPTY_STRING, null, null); } catch (ASTSemanticException e) { firstExpression.freeReferences(); throwBacktrack(e.getProblem()); @@ -1476,7 +1476,7 @@ public class Parser implements IParserData, IParser ? IASTExpression.Kind.PM_DOTSTAR : IASTExpression.Kind.PM_ARROWSTAR), firstExpression, secondExpression, null, null, - null, EMPTY_STRING, null); + null, EMPTY_STRING, null, null); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -1540,7 +1540,7 @@ public class Parser implements IParserData, IParser try { return astFactory.createExpression(scope, IASTExpression.Kind.CASTEXPRESSION, castExpression, - null, null, typeId, null, EMPTY_STRING, null); + null, null, typeId, null, EMPTY_STRING, null, null); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -1809,7 +1809,7 @@ public class Parser implements IParserData, IParser return astFactory.createExpression(scope, (vectored ? IASTExpression.Kind.DELETE_VECTORCASTEXPRESSION : IASTExpression.Kind.DELETE_CASTEXPRESSION), - castExpression, null, null, null, null, EMPTY_STRING, null); + castExpression, null, null, null, null, EMPTY_STRING, null, null); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -1953,7 +1953,7 @@ public class Parser implements IParserData, IParser astFactory.createNewDescriptor( newPlacementExpressions, newTypeIdExpressions, - newInitializerExpressions)); + newInitializerExpressions), null); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -2023,7 +2023,7 @@ public class Parser implements IParserData, IParser IASTExpression.Kind.NEW_TYPEID, null, null, null, typeId, null, EMPTY_STRING, astFactory.createNewDescriptor( newPlacementExpressions, newTypeIdExpressions, - newInitializerExpressions)); + newInitializerExpressions), null); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); return null; @@ -2105,7 +2105,7 @@ public class Parser implements IParserData, IParser try { return astFactory.createExpression(scope, IASTExpression.Kind.UNARY_SIZEOF_TYPEID, null, - null, null, d, null, EMPTY_STRING, null); + null, null, d, null, EMPTY_STRING, null, null); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -2116,7 +2116,7 @@ public class Parser implements IParserData, IParser return astFactory.createExpression(scope, IASTExpression.Kind.UNARY_SIZEOF_UNARYEXPRESSION, unaryExpression, null, null, null, null, - EMPTY_STRING, null); + EMPTY_STRING, null, null); } catch (ASTSemanticException e1) { throwBacktrack(e1.getProblem()); } catch (Exception e) { @@ -2195,7 +2195,7 @@ public class Parser implements IParserData, IParser ? IASTExpression.Kind.POSTFIX_TYPENAME_TEMPLATEID : IASTExpression.Kind.POSTFIX_TYPENAME_IDENTIFIER), expressionList, null, null, null, - nestedName, EMPTY_STRING, null); + nestedName, EMPTY_STRING, null, null); } catch (ASTSemanticException ase) { throwBacktrack(ase.getProblem()); } catch (Exception e) { @@ -2287,7 +2287,7 @@ public class Parser implements IParserData, IParser ? IASTExpression.Kind.POSTFIX_TYPEID_TYPEID : IASTExpression.Kind.POSTFIX_TYPEID_EXPRESSION), lhs, null, null, typeId, null, - EMPTY_STRING, null); + EMPTY_STRING, null, null); } catch (ASTSemanticException e6) { throwBacktrack(e6.getProblem()); } catch (Exception e) { @@ -2317,7 +2317,7 @@ public class Parser implements IParserData, IParser firstExpression = astFactory.createExpression(scope, IASTExpression.Kind.POSTFIX_SUBSCRIPT, firstExpression, secondExpression, null, null, - null, EMPTY_STRING, null); + null, EMPTY_STRING, null, null); } catch (ASTSemanticException e2) { throwBacktrack(e2.getProblem()); } catch (Exception e) { @@ -2361,7 +2361,7 @@ public class Parser implements IParserData, IParser firstExpression = astFactory.createExpression(scope, IASTExpression.Kind.POSTFIX_FUNCTIONCALL, firstExpression, secondExpression, null, null, - null, EMPTY_STRING, null); + null, EMPTY_STRING, null, null); } catch (ASTSemanticException e3) { throwBacktrack(e3.getProblem()); } catch (Exception e) { @@ -2376,7 +2376,7 @@ public class Parser implements IParserData, IParser firstExpression = astFactory.createExpression(scope, IASTExpression.Kind.POSTFIX_INCREMENT, firstExpression, null, null, null, null, - EMPTY_STRING, null); + EMPTY_STRING, null, null); } catch (ASTSemanticException e1) { throwBacktrack(e1.getProblem()); } catch (Exception e) { @@ -2391,7 +2391,7 @@ public class Parser implements IParserData, IParser firstExpression = astFactory.createExpression(scope, IASTExpression.Kind.POSTFIX_DECREMENT, firstExpression, null, null, null, null, - EMPTY_STRING, null); + EMPTY_STRING, null, null); } catch (ASTSemanticException e4) { throwBacktrack(e4.getProblem()); } catch (Exception e) { @@ -2429,7 +2429,7 @@ public class Parser implements IParserData, IParser firstExpression = astFactory.createExpression(scope, memberCompletionKind, firstExpression, secondExpression, null, null, null, - EMPTY_STRING, null); + EMPTY_STRING, null, null); } catch (ASTSemanticException e5) { throwBacktrack(e5.getProblem()); } catch (Exception e) { @@ -2466,7 +2466,7 @@ public class Parser implements IParserData, IParser firstExpression = astFactory.createExpression(scope, arrowCompletionKind, firstExpression, secondExpression, null, null, null, - EMPTY_STRING, null); + EMPTY_STRING, null, null); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -2523,7 +2523,7 @@ public class Parser implements IParserData, IParser int endOffset = consume(IToken.tRPAREN).getEndOffset(); try { return astFactory.createExpression(scope, type, inside, null, null, - null, null, EMPTY_STRING, null); + null, null, EMPTY_STRING, null, null); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -2549,7 +2549,7 @@ public class Parser implements IParserData, IParser try { return astFactory.createExpression(scope, IASTExpression.Kind.PRIMARY_INTEGER_LITERAL, null, - null, null, null, null, t.getCharImage(), null); + null, null, null, null, t.getCharImage(), null, (ITokenDuple)t); } catch (ASTSemanticException e1) { throwBacktrack(e1.getProblem()); } catch (Exception e) { @@ -2561,7 +2561,7 @@ public class Parser implements IParserData, IParser try { return astFactory.createExpression(scope, IASTExpression.Kind.PRIMARY_FLOAT_LITERAL, null, - null, null, null, null, t.getCharImage(), null); + null, null, null, null, t.getCharImage(), null, (ITokenDuple)t); } catch (ASTSemanticException e2) { throwBacktrack(e2.getProblem()); } catch (Exception e) { @@ -2574,7 +2574,7 @@ public class Parser implements IParserData, IParser try { return astFactory.createExpression(scope, IASTExpression.Kind.PRIMARY_STRING_LITERAL, null, - null, null, null, null, t.getCharImage(), null); + null, null, null, null, t.getCharImage(), null, (ITokenDuple)t); } catch (ASTSemanticException e5) { throwBacktrack(e5.getProblem()); } catch (Exception e) { @@ -2588,7 +2588,7 @@ public class Parser implements IParserData, IParser try { return astFactory.createExpression(scope, IASTExpression.Kind.PRIMARY_BOOLEAN_LITERAL, null, - null, null, null, null, t.getCharImage(), null); + null, null, null, null, t.getCharImage(), null, (ITokenDuple)t); } catch (ASTSemanticException e3) { throwBacktrack(e3.getProblem()); } catch (Exception e) { @@ -2603,7 +2603,7 @@ public class Parser implements IParserData, IParser try { return astFactory.createExpression(scope, IASTExpression.Kind.PRIMARY_CHAR_LITERAL, null, - null, null, null, null, t.getCharImage(), null); + null, null, null, null, t.getCharImage(), null, (ITokenDuple)t); } catch (ASTSemanticException e4) { throwBacktrack(e4.getProblem()); } catch (Exception e) { @@ -2616,7 +2616,7 @@ public class Parser implements IParserData, IParser try { return astFactory.createExpression(scope, IASTExpression.Kind.PRIMARY_THIS, null, null, null, - null, null, EMPTY_STRING, null); + null, null, EMPTY_STRING, null, (ITokenDuple)t); } catch (ASTSemanticException e7) { throwBacktrack(e7.getProblem()); } catch (Exception e) { @@ -2642,7 +2642,7 @@ public class Parser implements IParserData, IParser try { return astFactory.createExpression(scope, IASTExpression.Kind.PRIMARY_BRACKETED_EXPRESSION, - lhs, null, null, null, null, EMPTY_STRING, null); + lhs, null, null, null, null, EMPTY_STRING, null, (ITokenDuple)t); } catch (ASTSemanticException e6) { throwBacktrack(e6.getProblem()); } catch (Exception e) { @@ -2691,7 +2691,7 @@ public class Parser implements IParserData, IParser try { return astFactory.createExpression(scope, IASTExpression.Kind.ID_EXPRESSION, null, null, - null, null, duple, EMPTY_STRING, null); + null, null, duple, EMPTY_STRING, null, duple); } catch (ASTSemanticException e8) { throwBacktrack(e8.getProblem()); } catch (Exception e) { @@ -2713,7 +2713,7 @@ public class Parser implements IParserData, IParser try { empty = astFactory.createExpression(scope, IASTExpression.Kind.PRIMARY_EMPTY, null, null, - null, null, null, EMPTY_STRING, null); + null, null, null, EMPTY_STRING, null, (ITokenDuple)la); } catch (ASTSemanticException e9) { throwBacktrack( e9.getProblem() ); return null; @@ -2756,7 +2756,7 @@ public class Parser implements IParserData, IParser int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0; try { return astFactory.createExpression(scope, kind, lhs, - assignmentExpression, null, null, null, EMPTY_STRING, null); + assignmentExpression, null, null, null, EMPTY_STRING, null, null); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -2780,7 +2780,7 @@ public class Parser implements IParserData, IParser int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0; try { return astFactory.createExpression(scope, kind, castExpression, - null, null, null, null, EMPTY_STRING, null); + null, null, null, null, EMPTY_STRING, null, null); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -2809,7 +2809,7 @@ public class Parser implements IParserData, IParser int endOffset = consume(IToken.tRPAREN).getEndOffset(); try { return astFactory.createExpression(scope, kind, lhs, null, null, - duple, null, EMPTY_STRING, null); + duple, null, EMPTY_STRING, null, null); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -6926,4 +6926,5 @@ public class Parser implements IParserData, IParser references.clear(); } + } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEmptyExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEmptyExpression.java index f78462e225e..dbcce88de22 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEmptyExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEmptyExpression.java @@ -36,4 +36,60 @@ public class ASTEmptyExpression extends ASTExpression { public String toString(){ return ASTUtil.getExpressionString( this ); } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffsetAndLineNumber(int, int) + */ + public void setStartingOffsetAndLineNumber(int offset, int lineNumber) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffsetAndLineNumber(int, int) + */ + public void setEndingOffsetAndLineNumber(int offset, int lineNumber) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset() + */ + public int getStartingOffset() { + // TODO Auto-generated method stub + return 0; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset() + */ + public int getEndingOffset() { + // TODO Auto-generated method stub + return 0; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingLine() + */ + public int getStartingLine() { + // TODO Auto-generated method stub + return 0; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingLine() + */ + public int getEndingLine() { + // TODO Auto-generated method stub + return 0; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getFilename() + */ + public char[] getFilename() { + // TODO Auto-generated method stub + return null; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTIdExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTIdExpression.java index 355907f5de9..a9334b3c693 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTIdExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTIdExpression.java @@ -52,4 +52,58 @@ public class ASTIdExpression extends ASTExpression { public String toString(){ return ASTUtil.getExpressionString( this ); } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffsetAndLineNumber(int, int) + */ + public void setStartingOffsetAndLineNumber(int offset, int lineNumber) { + // TODO Auto-generated method stub + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffsetAndLineNumber(int, int) + */ + public void setEndingOffsetAndLineNumber(int offset, int lineNumber) { + // TODO Auto-generated method stub + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset() + */ + public int getStartingOffset() { + // TODO Auto-generated method stub + return idExpression.getStartOffset(); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset() + */ + public int getEndingOffset() { + // TODO Auto-generated method stub + return idExpression.getEndOffset(); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingLine() + */ + public int getStartingLine() { + // TODO Auto-generated method stub + return idExpression.getLineNumber(); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingLine() + */ + public int getEndingLine() { + // TODO Auto-generated method stub + return idExpression.getLineNumber(); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getFilename() + */ + public char[] getFilename() { + // TODO Auto-generated method stub + return idExpression.getFilename(); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTLiteralExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTLiteralExpression.java index 5d469a2a15b..6805f06af3a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTLiteralExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTLiteralExpression.java @@ -41,4 +41,60 @@ public class ASTLiteralExpression extends ASTExpression { public String toString(){ return ASTUtil.getExpressionString( this ); } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffsetAndLineNumber(int, int) + */ + public void setStartingOffsetAndLineNumber(int offset, int lineNumber) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffsetAndLineNumber(int, int) + */ + public void setEndingOffsetAndLineNumber(int offset, int lineNumber) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset() + */ + public int getStartingOffset() { + // TODO Auto-generated method stub + return 0; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset() + */ + public int getEndingOffset() { + // TODO Auto-generated method stub + return 0; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingLine() + */ + public int getStartingLine() { + // TODO Auto-generated method stub + return 0; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingLine() + */ + public int getEndingLine() { + // TODO Auto-generated method stub + return 0; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getFilename() + */ + public char[] getFilename() { + // TODO Auto-generated method stub + return null; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNewExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNewExpression.java index 506b64f26b3..eae367406d3 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNewExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNewExpression.java @@ -111,4 +111,60 @@ public class ASTNewExpression extends ASTExpression { return ownerExpression; } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffsetAndLineNumber(int, int) + */ + public void setStartingOffsetAndLineNumber(int offset, int lineNumber) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffsetAndLineNumber(int, int) + */ + public void setEndingOffsetAndLineNumber(int offset, int lineNumber) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset() + */ + public int getStartingOffset() { + // TODO Auto-generated method stub + return 0; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset() + */ + public int getEndingOffset() { + // TODO Auto-generated method stub + return 0; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingLine() + */ + public int getStartingLine() { + // TODO Auto-generated method stub + return 0; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingLine() + */ + public int getEndingLine() { + // TODO Auto-generated method stub + return 0; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getFilename() + */ + public char[] getFilename() { + // TODO Auto-generated method stub + return null; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypeIdExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypeIdExpression.java index 5c078514519..002cace13c3 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypeIdExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypeIdExpression.java @@ -65,4 +65,53 @@ public class ASTTypeIdExpression extends ASTExpression { return this; return super.findOwnerExpressionForIDExpression(duple); } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffsetAndLineNumber(int, int) + */ + public void setStartingOffsetAndLineNumber(int offset, int lineNumber) { + // TODO Auto-generated method stub + + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffsetAndLineNumber(int, int) + */ + public void setEndingOffsetAndLineNumber(int offset, int lineNumber) { + // TODO Auto-generated method stub + + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset() + */ + public int getStartingOffset() { + // TODO Auto-generated method stub + return 0; + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset() + */ + public int getEndingOffset() { + // TODO Auto-generated method stub + return 0; + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingLine() + */ + public int getStartingLine() { + // TODO Auto-generated method stub + return 0; + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingLine() + */ + public int getEndingLine() { + // TODO Auto-generated method stub + return 0; + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getFilename() + */ + public char[] getFilename() { + // TODO Auto-generated method stub + return null; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTUnaryExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTUnaryExpression.java index 6c1ac9eece7..ac845685ecd 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTUnaryExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTUnaryExpression.java @@ -88,4 +88,53 @@ public class ASTUnaryExpression extends ASTExpression { public String toString(){ return ASTUtil.getExpressionString( this ); } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffsetAndLineNumber(int, int) + */ + public void setStartingOffsetAndLineNumber(int offset, int lineNumber) { + // TODO Auto-generated method stub + + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffsetAndLineNumber(int, int) + */ + public void setEndingOffsetAndLineNumber(int offset, int lineNumber) { + // TODO Auto-generated method stub + + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset() + */ + public int getStartingOffset() { + // TODO Auto-generated method stub + return lhs.getStartingOffset(); + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset() + */ + public int getEndingOffset() { + // TODO Auto-generated method stub + return lhs.getEndingOffset(); + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingLine() + */ + public int getStartingLine() { + // TODO Auto-generated method stub + return lhs.getStartingLine(); + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingLine() + */ + public int getEndingLine() { + // TODO Auto-generated method stub + return lhs.getEndingLine(); + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getFilename() + */ + public char[] getFilename() { + // TODO Auto-generated method stub + return lhs.getFilename(); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java index d6cd625a9b8..8e633be41bc 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java @@ -123,6 +123,9 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto private final CharArrayObjectMap simpleTypeSpecCache = new CharArrayObjectMap( BUILTIN_TYPE_SIZE ); private static final int DEFAULT_QUALIFIEDNAME_REFERENCE_SIZE = 4; private char[] filename; + private int problemStartOffset = -1; + private int problemEndOffset = -1; + private int problemLineNumber = -1; static { @@ -213,11 +216,11 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto return true; } - private ISymbol lookupElement (IContainerSymbol startingScope, char[] name, ITypeInfo.eType type, List parameters, LookupType lookupType ) throws ASTSemanticException { - return lookupElement( startingScope, name, type, parameters, null, lookupType ); + private ISymbol lookupElement (IContainerSymbol startingScope, char[] name, ITypeInfo.eType type, List parameters, LookupType lookupType) throws ASTSemanticException { + return lookupElement( startingScope, name, type, parameters, null, lookupType); } - private ISymbol lookupElement (IContainerSymbol startingScope, char[] name, ITypeInfo.eType type, List parameters, List arguments, LookupType lookupType ) throws ASTSemanticException { + private ISymbol lookupElement (IContainerSymbol startingScope, char[] name, ITypeInfo.eType type, List parameters, List arguments, LookupType lookupType) throws ASTSemanticException { ISymbol result = null; if( startingScope == null ) return null; try { @@ -269,7 +272,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto return lookupQualifiedName(startingScope, name, ITypeInfo.t_any, null, 0, references, throwOnError, lookup ); } - protected ISymbol lookupQualifiedName( IContainerSymbol startingScope, char[] name, ITypeInfo.eType type, List parameters, int offset, List references, boolean throwOnError, LookupType lookup ) throws ASTSemanticException + protected ISymbol lookupQualifiedName( IContainerSymbol startingScope, char[] name, ITypeInfo.eType type, List parameters, int offset, List references, boolean throwOnError, LookupType lookup) throws ASTSemanticException { ISymbol result = null; if( name == null && throwOnError ) @@ -306,6 +309,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto protected ISymbol lookupQualifiedName( IContainerSymbol startingScope, ITokenDuple name, ITypeInfo.eType type, List parameters, List references, boolean throwOnError, LookupType lookup ) throws ASTSemanticException { + setProblemInfo(name); ISymbol result = null; if( name == null && throwOnError ) handleProblem( IProblem.SEMANTIC_NAME_NOT_PROVIDED, null ); else if( name == null ) return null; @@ -466,7 +470,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto int startingLine, int endingOffset, int endingLine) throws ASTSemanticException { - setFilename( duple ); + setProblemInfo( duple ); List references = new ArrayList(); ISymbol symbol = lookupQualifiedName( scopeToSymbol( scope), duple, references, true ); @@ -485,14 +489,6 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto return using; } - - - /** - * @param duple - */ - private void setFilename(ITokenDuple duple) { - filename = ( duple == null ) ? EMPTY_STRING : duple.getFilename(); - } protected IContainerSymbol getScopeToSearchUpon( IASTScope currentScope, @@ -525,7 +521,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto int startingOffset, int startingLine, int endingOffset, int endingLine) throws ASTSemanticException { - setFilename( name ); + setProblemInfo( name ); List references = new ArrayList(); IUsingDeclarationSymbol endResult = null; @@ -832,12 +828,12 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto protected void handleProblem( int id, char[] attribute ) throws ASTSemanticException { - handleProblem( null, id, attribute, -1, -1, -1, true ); //TODO make this right + handleProblem( null, id, attribute, problemStartOffset, problemEndOffset, problemLineNumber, true ); } protected void handleProblem( IASTScope scope, int id, char[] attribute ) throws ASTSemanticException { - handleProblem( scope, id, attribute, -1, -1, -1, true); + handleProblem( scope, id, attribute, problemStartOffset, problemEndOffset, problemLineNumber, true); } protected void handleProblem( int id, char[] attribute, int startOffset, int endOffset, int lineNumber, boolean isError ) throws ASTSemanticException { @@ -905,7 +901,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto ASTAccessVisibility visibility, ITokenDuple parentClassName) throws ASTSemanticException { - setFilename( parentClassName ); + setProblemInfo( parentClassName ); IDerivableContainerSymbol classSymbol = (IDerivableContainerSymbol)scopeToSymbol( astClassSpec); List references = new ArrayList(); @@ -1086,9 +1082,9 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto IASTExpression rhs, IASTExpression thirdExpression, IASTTypeId typeId, - ITokenDuple idExpression, char[] literal, IASTNewExpressionDescriptor newDescriptor) throws ASTSemanticException + ITokenDuple idExpression, char[] literal, IASTNewExpressionDescriptor newDescriptor, ITokenDuple extra) throws ASTSemanticException { - setFilename( idExpression ); + setProblemInfo( extra ); if( idExpression != null && logService.isTracing() ) { TraceUtil.outputTrace( @@ -1116,7 +1112,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto ISymbol symbol = getExpressionSymbol(scope, kind, lhs, rhs, idExpression, references ); // Try to figure out the result that this expression evaluates to - ExpressionResult expressionResult = getExpressionResultType(scope, kind, lhs, rhs, thirdExpression, typeId, literal, symbol); + ExpressionResult expressionResult = getExpressionResultType(scope, kind, lhs, rhs, thirdExpression, typeId, literal, symbol, extra); if( newDescriptor != null ){ createConstructorReference( newDescriptor, typeId, references ); @@ -1372,7 +1368,12 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto * Apply the usual arithmetic conversions to find out the result of an expression * that has a lhs and a rhs as indicated in the specs (section 5.Expressions, page 64) */ - protected ITypeInfo usualArithmeticConversions( IASTScope scope, ITypeInfo lhs, ITypeInfo rhs) throws ASTSemanticException{ + protected ITypeInfo usualArithmeticConversions( IASTScope scope, ASTExpression lhsExp, ASTExpression rhsExp) throws ASTSemanticException{ + setFilename(lhsExp.getFilename()); + + ITypeInfo lhs = lhsExp.getResultType().getResult(); + ITypeInfo rhs = rhsExp.getResultType().getResult(); + if( lhs == null ) return null; if( rhs == null ) return null; // if you have a variable of type basic type, then we need to go to the basic type first @@ -1382,12 +1383,11 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto while( (rhs.getType() == ITypeInfo.t_type) && (rhs.getTypeSymbol() != null)){ rhs = rhs.getTypeSymbol().getTypeInfo(); } - - if( !lhs.isType(ITypeInfo.t__Bool, ITypeInfo.t_enumerator ) || - !rhs.isType(ITypeInfo.t__Bool, ITypeInfo.t_enumerator ) ) - { - handleProblem( scope, IProblem.SEMANTIC_INVALID_CONVERSION_TYPE, null ); - } + + if( !lhs.isType(ITypeInfo.t__Bool, ITypeInfo.t_enumerator ) ) + handleProblem( scope, IProblem.SEMANTIC_INVALID_CONVERSION_TYPE, null, lhsExp.getStartingOffset(), lhsExp.getEndingOffset(), lhsExp.getStartingLine(), true ); + if( !rhs.isType(ITypeInfo.t__Bool, ITypeInfo.t_enumerator ) ) + handleProblem( scope, IProblem.SEMANTIC_INVALID_CONVERSION_TYPE, null, rhsExp.getStartingOffset(), rhsExp.getEndingOffset(), rhsExp.getStartingLine(), true ); ITypeInfo info = TypeInfoProvider.newTypeInfo( ); if( @@ -1553,8 +1553,9 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto IASTExpression thirdExpression, IASTTypeId typeId, char[] literal, - ISymbol symbol) throws ASTSemanticException + ISymbol symbol, ITokenDuple extra) throws ASTSemanticException { + setProblemInfo(extra); ITypeInfo info = null; ExpressionResult result = null; @@ -1738,9 +1739,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto ASTExpression left = (ASTExpression)lhs; ASTExpression right = (ASTExpression)rhs; if((left != null ) && (right != null)){ - ITypeInfo leftType =left.getResultType().getResult(); - ITypeInfo rightType =right.getResultType().getResult(); - info = usualArithmeticConversions( scope, leftType, rightType); + info = usualArithmeticConversions( scope, left, right); } else handleProblem( scope, IProblem.SEMANTIC_MALFORMED_EXPRESSION, null ); @@ -1903,7 +1902,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto IASTScope scope, ITokenDuple duple, IASTExpression expressionList) { - setFilename( duple ); + setProblemInfo( duple ); List references = new ArrayList(); IContainerSymbol scopeSymbol = scopeToSymbol(scope); @@ -1953,7 +1952,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto boolean isImaginary, boolean isGlobal, Map extensionParms ) throws ASTSemanticException { - setFilename( typeName ); + setProblemInfo( typeName ); if( extension.overrideCreateSimpleTypeSpecifierMethod( kind )) return extension.createSimpleTypeSpecifier(pst, scope, kind, typeName, isShort, isLong, isSigned, isUnsigned, isTypename, isComplex, isImaginary, isGlobal, extensionParms ); char[] typeNameAsString = typeName.toCharArray(); @@ -2101,7 +2100,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto boolean isExplicit, boolean isPureVirtual, List constructorChain, boolean isFunctionDefinition, boolean hasFunctionTryBlock, boolean hasVariableArguments ) throws ASTSemanticException { - setFilename( name ); + setProblemInfo( name ); List references = new ArrayList(); IContainerSymbol ownerScope = scopeToSymbol( scope ); @@ -2469,7 +2468,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto boolean isPureVirtual, ASTAccessVisibility visibility, List constructorChain, List references, boolean isFunctionDefinition, boolean hasFunctionTryBlock, boolean hasVariableArguments ) throws ASTSemanticException { - setFilename( nameDuple ); + setProblemInfo( nameDuple ); boolean isConstructor = false; boolean isDestructor = false; @@ -2677,7 +2676,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto IContainerSymbol ownerScope = scopeToSymbol( scope ); if( name == null ) - handleProblem( IProblem.SEMANTIC_NAME_NOT_PROVIDED, null, startingOffset, nameEndOffset, nameLine, true ); + handleProblem( IProblem.SEMANTIC_NAME_NOT_PROVIDED, null, startingOffset, startingOffset + 1, startingLine, true ); if(name.getSegmentCount() > 1) { @@ -2752,7 +2751,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto } catch (ParserSymbolTableException e) { - handleProblem(e.createProblemID(), name.getFirstToken().getCharImage() ); + handleProblem(e.createProblemID(), name.getFirstToken().getCharImage(), name.getFirstToken().getOffset(), name.getFirstToken().getEndOffset(), name.getFirstToken().getLineNumber(), true ); } ASTVariable variable = new ASTVariable( newSymbol, abstractDeclaration, initializerClause, bitfieldExpression, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, references, constructorExpression, previouslyDeclared, filename ); @@ -2993,7 +2992,10 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto } catch (ParserSymbolTableException e) { - handleProblem(e.createProblemID(), image ); + if (name==null) + handleProblem(e.createProblemID(), image ); + else + handleProblem(e.createProblemID(), image, name.getStartOffset(), name.getEndOffset(), name.getLineNumber(), true ); } ASTField field = new ASTField( newSymbol, abstractDeclaration, initializerClause, bitfieldExpression, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, references, previouslyDeclared, constructorExpression, visibility, filename ); @@ -3199,7 +3201,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto public IASTElaboratedTypeSpecifier createElaboratedTypeSpecifier(IASTScope scope, ASTClassKind kind, ITokenDuple name, int startingOffset, int startingLine, int endOffset, int endingLine, boolean isForewardDecl, boolean isFriend) throws ASTSemanticException { - setFilename( name ); + setProblemInfo( name ); IContainerSymbol currentScopeSymbol = scopeToSymbol(scope); IContainerSymbol originalScope = currentScopeSymbol; @@ -3343,7 +3345,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto */ public IASTNamespaceAlias createNamespaceAlias(IASTScope scope, char[] identifier, ITokenDuple alias, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endOffset, int endingLine) throws ASTSemanticException { - setFilename( alias ); + setProblemInfo( alias ); IContainerSymbol startingSymbol = scopeToSymbol(scope); List references = new ArrayList(); @@ -3797,4 +3799,17 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto return (pst.getTypeInfoProvider().numAllocated() == 0); } + private void setProblemInfo(ITokenDuple extra) { + if (extra != null) { + this.problemStartOffset = extra.getStartOffset(); + this.problemEndOffset = extra.getEndOffset(); + this.problemLineNumber = extra.getLineNumber(); + this.filename = extra.getFilename(); + } else { + this.problemStartOffset = -1; + this.problemEndOffset = -1; + this.problemLineNumber = -1; + this.filename = EMPTY_STRING; + } + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTExpression.java index e93100433c2..587302adb4b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTExpression.java @@ -235,5 +235,61 @@ public class ASTExpression implements IASTExpression { public void freeReferences() { } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffsetAndLineNumber(int, int) + */ + public void setStartingOffsetAndLineNumber(int offset, int lineNumber) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffsetAndLineNumber(int, int) + */ + public void setEndingOffsetAndLineNumber(int offset, int lineNumber) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset() + */ + public int getStartingOffset() { + // TODO Auto-generated method stub + return 0; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset() + */ + public int getEndingOffset() { + // TODO Auto-generated method stub + return 0; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingLine() + */ + public int getStartingLine() { + // TODO Auto-generated method stub + return 0; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingLine() + */ + public int getEndingLine() { + // TODO Auto-generated method stub + return 0; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getFilename() + */ + public char[] getFilename() { + // TODO Auto-generated method stub + return null; + } + } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java index 10b8f62aed8..e97843e2ba4 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java @@ -157,7 +157,7 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createExpression(org.eclipse.cdt.core.parser.ast.IASTExpression.ExpressionKind, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTExpression, java.lang.String, java.lang.String, java.lang.String) */ - public IASTExpression createExpression(IASTScope scope, Kind kind, IASTExpression lhs, IASTExpression rhs, IASTExpression thirdExpression, IASTTypeId typeId, ITokenDuple idExpression, char[] literal, IASTNewExpressionDescriptor newDescriptor) { + public IASTExpression createExpression(IASTScope scope, Kind kind, IASTExpression lhs, IASTExpression rhs, IASTExpression thirdExpression, IASTTypeId typeId, ITokenDuple idExpression, char[] literal, IASTNewExpressionDescriptor newDescriptor, ITokenDuple extra) { return temporarilyDisableNodeConstruction ? ExpressionFactory.createExpression( kind, lhs, rhs, thirdExpression, typeId, idExpression == null ? EMPTY_STRING : idExpression.toCharArray(), literal, newDescriptor ) : null; //$NON-NLS-1$ }