From 0ad6f1bcb025a884d75816294d8f31d01f12da79 Mon Sep 17 00:00:00 2001 From: John Camelon Date: Sat, 20 Nov 2004 17:56:43 +0000 Subject: [PATCH] Applied patch for Devin Steffler. Fixed 78217 - [Parser][IProblems] template operator has invalid IProblem with blank description Fixed 79103 - [Parser][IProblems] 3 new lineNumber=-1 found in cpp_headers --- .../cdt/internal/core/parser/Parser.java | 73 +++++++++---------- .../core/parser/ParserMessages.properties | 1 + .../internal/core/parser/problem/Problem.java | 3 + 3 files changed, 39 insertions(+), 38 deletions(-) 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 37f81f7fea2..d188fb05426 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 @@ -374,7 +374,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); + null, typeId, null, EMPTY_STRING, null, (ITokenDuple)start); list.add(expression); completedArg = true; } catch (BacktrackException e) { @@ -407,7 +407,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, null, nameDuple, EMPTY_STRING, null, (ITokenDuple)start); list.add(expression); continue; } catch (ASTSemanticException e) { @@ -830,7 +830,7 @@ public class Parser implements IParserData, IParser assignmentExpression = astFactory.createExpression(scope, IASTExpression.Kind.EXPRESSIONLIST, assignmentExpression, secondExpression, null, null, - null, EMPTY_STRING, null, null); + null, EMPTY_STRING, null, (ITokenDuple)la); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -871,7 +871,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, null ); + resultExpression = astFactory.createExpression( scope, extension.getExpressionKindForStatement(), null, null, null, null, null,EMPTY_STRING, null, (ITokenDuple)la ); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); @@ -973,7 +973,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, null, EMPTY_STRING, null, (ITokenDuple)throwToken); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -1009,7 +1009,7 @@ public class Parser implements IParserData, IParser return astFactory.createExpression(scope, IASTExpression.Kind.CONDITIONALEXPRESSION, firstExpression, secondExpression, thirdExpression, - null, null, EMPTY_STRING, null, null); + null, null, EMPTY_STRING, null, (ITokenDuple)la); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -1041,7 +1041,7 @@ public class Parser implements IParserData, IParser firstExpression = astFactory.createExpression(scope, IASTExpression.Kind.LOGICALOREXPRESSION, firstExpression, secondExpression, null, null, null, - EMPTY_STRING, null, null); + EMPTY_STRING, null, (ITokenDuple)la); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -1073,7 +1073,7 @@ public class Parser implements IParserData, IParser firstExpression = astFactory.createExpression(scope, IASTExpression.Kind.LOGICALANDEXPRESSION, firstExpression, secondExpression, null, null, null, - EMPTY_STRING, null, null); + EMPTY_STRING, null, (ITokenDuple)la); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -1106,7 +1106,7 @@ public class Parser implements IParserData, IParser firstExpression = astFactory.createExpression(scope, IASTExpression.Kind.INCLUSIVEOREXPRESSION, firstExpression, secondExpression, null, null, null, - EMPTY_STRING, null, null); + EMPTY_STRING, null, (ITokenDuple)la); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -1139,7 +1139,7 @@ public class Parser implements IParserData, IParser firstExpression = astFactory.createExpression(scope, IASTExpression.Kind.EXCLUSIVEOREXPRESSION, firstExpression, secondExpression, null, null, null, - EMPTY_STRING, null, null); + EMPTY_STRING, null, (ITokenDuple)la); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -1171,7 +1171,7 @@ public class Parser implements IParserData, IParser try { firstExpression = astFactory.createExpression(scope, IASTExpression.Kind.ANDEXPRESSION, firstExpression, - secondExpression, null, null, null, EMPTY_STRING, null, null); + secondExpression, null, null, null, EMPTY_STRING, null, (ITokenDuple)la); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -1229,7 +1229,7 @@ public class Parser implements IParserData, IParser ? IASTExpression.Kind.EQUALITY_EQUALS : IASTExpression.Kind.EQUALITY_NOTEQUALS, firstExpression, secondExpression, null, null, - null, EMPTY_STRING, null, null); + null, EMPTY_STRING, null, (ITokenDuple)la); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -1296,7 +1296,7 @@ public class Parser implements IParserData, IParser firstExpression = astFactory.createExpression(scope, expressionKind, firstExpression, secondExpression, null, null, null, - EMPTY_STRING, null, null); + EMPTY_STRING, null, (ITokenDuple)la); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -1344,7 +1344,7 @@ public class Parser implements IParserData, IParser ? IASTExpression.Kind.SHIFT_LEFT : IASTExpression.Kind.SHIFT_RIGHT), firstExpression, secondExpression, null, null, - null, EMPTY_STRING, null, null); + null, EMPTY_STRING, null, (ITokenDuple)la); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -1385,7 +1385,7 @@ public class Parser implements IParserData, IParser ? IASTExpression.Kind.ADDITIVE_PLUS : IASTExpression.Kind.ADDITIVE_MINUS), firstExpression, secondExpression, null, null, - null, EMPTY_STRING, null, null); + null, EMPTY_STRING, null, (ITokenDuple)la); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -1437,7 +1437,7 @@ public class Parser implements IParserData, IParser firstExpression = astFactory.createExpression(scope, expressionKind, firstExpression, secondExpression, null, null, null, - EMPTY_STRING, null, null); + EMPTY_STRING, null, (ITokenDuple)la); } catch (ASTSemanticException e) { firstExpression.freeReferences(); throwBacktrack(e.getProblem()); @@ -1479,7 +1479,7 @@ public class Parser implements IParserData, IParser ? IASTExpression.Kind.PM_DOTSTAR : IASTExpression.Kind.PM_ARROWSTAR), firstExpression, secondExpression, null, null, - null, EMPTY_STRING, null, null); + null, EMPTY_STRING, null, (ITokenDuple)la); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -1543,7 +1543,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, null, typeId, null, EMPTY_STRING, null, (ITokenDuple)la); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -1812,7 +1812,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, null); + castExpression, null, null, null, null, EMPTY_STRING, null, (ITokenDuple)la); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -1956,7 +1956,7 @@ public class Parser implements IParserData, IParser astFactory.createNewDescriptor( newPlacementExpressions, newTypeIdExpressions, - newInitializerExpressions), null); + newInitializerExpressions), (ITokenDuple)la); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -2026,7 +2026,7 @@ public class Parser implements IParserData, IParser IASTExpression.Kind.NEW_TYPEID, null, null, null, typeId, null, EMPTY_STRING, astFactory.createNewDescriptor( newPlacementExpressions, newTypeIdExpressions, - newInitializerExpressions), null); + newInitializerExpressions), (ITokenDuple)la); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); return null; @@ -2108,7 +2108,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, null, d, null, EMPTY_STRING, null, (ITokenDuple)la); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -2119,7 +2119,7 @@ public class Parser implements IParserData, IParser return astFactory.createExpression(scope, IASTExpression.Kind.UNARY_SIZEOF_UNARYEXPRESSION, unaryExpression, null, null, null, null, - EMPTY_STRING, null, null); + EMPTY_STRING, null, (ITokenDuple)la); } catch (ASTSemanticException e1) { throwBacktrack(e1.getProblem()); } catch (Exception e) { @@ -2198,7 +2198,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, null); + nestedName, EMPTY_STRING, null, (ITokenDuple)la); } catch (ASTSemanticException ase) { throwBacktrack(ase.getProblem()); } catch (Exception e) { @@ -2290,7 +2290,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, null); + EMPTY_STRING, null, (ITokenDuple)la); } catch (ASTSemanticException e6) { throwBacktrack(e6.getProblem()); } catch (Exception e) { @@ -2320,7 +2320,7 @@ public class Parser implements IParserData, IParser firstExpression = astFactory.createExpression(scope, IASTExpression.Kind.POSTFIX_SUBSCRIPT, firstExpression, secondExpression, null, null, - null, EMPTY_STRING, null, null); + null, EMPTY_STRING, null, (ITokenDuple)la); } catch (ASTSemanticException e2) { throwBacktrack(e2.getProblem()); } catch (Exception e) { @@ -2364,7 +2364,7 @@ public class Parser implements IParserData, IParser firstExpression = astFactory.createExpression(scope, IASTExpression.Kind.POSTFIX_FUNCTIONCALL, firstExpression, secondExpression, null, null, - null, EMPTY_STRING, null, null); + null, EMPTY_STRING, null, (ITokenDuple)la); } catch (ASTSemanticException e3) { throwBacktrack(e3.getProblem()); } catch (Exception e) { @@ -2379,7 +2379,7 @@ public class Parser implements IParserData, IParser firstExpression = astFactory.createExpression(scope, IASTExpression.Kind.POSTFIX_INCREMENT, firstExpression, null, null, null, null, - EMPTY_STRING, null, null); + EMPTY_STRING, null, (ITokenDuple)la); } catch (ASTSemanticException e1) { throwBacktrack(e1.getProblem()); } catch (Exception e) { @@ -2394,7 +2394,7 @@ public class Parser implements IParserData, IParser firstExpression = astFactory.createExpression(scope, IASTExpression.Kind.POSTFIX_DECREMENT, firstExpression, null, null, null, null, - EMPTY_STRING, null, null); + EMPTY_STRING, null, (ITokenDuple)la); } catch (ASTSemanticException e4) { throwBacktrack(e4.getProblem()); } catch (Exception e) { @@ -2432,7 +2432,7 @@ public class Parser implements IParserData, IParser firstExpression = astFactory.createExpression(scope, memberCompletionKind, firstExpression, secondExpression, null, null, null, - EMPTY_STRING, null, null); + EMPTY_STRING, null, (ITokenDuple)la); } catch (ASTSemanticException e5) { throwBacktrack(e5.getProblem()); } catch (Exception e) { @@ -2469,7 +2469,7 @@ public class Parser implements IParserData, IParser firstExpression = astFactory.createExpression(scope, arrowCompletionKind, firstExpression, secondExpression, null, null, null, - EMPTY_STRING, null, null); + EMPTY_STRING, null, (ITokenDuple)la); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -2516,7 +2516,6 @@ public class Parser implements IParserData, IParser int startingOffset = la.getOffset(); int line = la.getLineNumber(); char [] fn = la.getFilename(); - la = null; char[] typeName = consume().getCharImage(); consume(IToken.tLPAREN); setCurrentFunctionName(typeName); @@ -2526,7 +2525,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, null, EMPTY_STRING, null, (ITokenDuple)la); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -2759,7 +2758,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, null); + assignmentExpression, null, null, null, EMPTY_STRING, null, (ITokenDuple)t); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -2777,13 +2776,12 @@ public class Parser implements IParserData, IParser int startingOffset = la.getOffset(); int line = la.getLineNumber(); char [] fn = la.getFilename(); - la = null; IASTExpression castExpression = castExpression(scope, completionKind, key); 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, null, EMPTY_STRING, null, (ITokenDuple)la); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { @@ -2800,7 +2798,6 @@ public class Parser implements IParserData, IParser int startingOffset = la.getOffset(); int line = la.getLineNumber(); char [] fn = la.getFilename(); - la = null; consume(); consume(IToken.tLT); @@ -2812,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, null); + duple, null, EMPTY_STRING, null, (ITokenDuple)la); } catch (ASTSemanticException e) { throwBacktrack(e.getProblem()); } catch (Exception e) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ParserMessages.properties b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ParserMessages.properties index 02caa2ca944..d2c729c2ec6 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ParserMessages.properties +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ParserMessages.properties @@ -57,6 +57,7 @@ ASTProblemFactory.error.semantic.uniqueNamePredefined=Attempt to introduce uniqu ASTProblemFactory.error.semantic.nameNotFound=Attempt to use symbol failed : {0} ASTProblemFactory.error.semantic.nameNotProvided=Name not provided. ASTProblemFactory.error.semantic.invalidConversionType=Invalid arithmetic conversion +ASTProblemFactory.error.semantic.malformedExpression=Malformed expression LineOffsetReconciler.error.couldNotResetReader=Could not reset Reader diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/problem/Problem.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/problem/Problem.java index dfabe1750da..ff026ed096f 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/problem/Problem.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/problem/Problem.java @@ -112,6 +112,9 @@ public class Problem implements IProblem { errorMessages.put( new Integer( IProblem.SEMANTIC_INVALID_CONVERSION_TYPE ), ParserMessages.getString("ASTProblemFactory.error.semantic.invalidConversionType")); //$NON-NLS-1$ + errorMessages.put( + new Integer( IProblem.SEMANTIC_MALFORMED_EXPRESSION ), + ParserMessages.getString("ASTProblemFactory.error.semantic.malformedExpression")); //$NON-NLS-1$ errorMessages.put( new Integer( IProblem.SEMANTIC_AMBIGUOUS_LOOKUP ), ParserMessages.getString("ASTProblemFactory.error.semantic.pst.ambiguousLookup")); //$NON-NLS-1$