1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 09:25:31 +02:00

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
This commit is contained in:
John Camelon 2004-11-20 17:56:43 +00:00
parent 78555dc686
commit 0ad6f1bcb0
3 changed files with 39 additions and 38 deletions

View file

@ -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) {

View file

@ -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

View file

@ -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$