diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ITokenDuple.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ITokenDuple.java index 844c706d0fc..ffede24db21 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ITokenDuple.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ITokenDuple.java @@ -57,7 +57,7 @@ public interface ITokenDuple { */ public abstract boolean syntaxOfName(); - public String extractNameFromTemplateId(); + public char[] extractNameFromTemplateId(); /** * @param duple * @return 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 43e2af6a7c5..e64672dafc2 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 @@ -25,14 +25,14 @@ import org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescripto public interface IASTFactory { public IASTMacro createMacro( - String name, + char[] name, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endingOffset, int endingLine, IMacroDescriptor info, char[] fn); public IASTInclusion createInclusion( - String name, - String fileName, + char[] name, + char[] fileName, boolean local, int startingOffset, int startingLine, @@ -50,19 +50,19 @@ public interface IASTFactory public IASTASMDefinition createASMDefinition( IASTScope scope, - String assembly, + char[] assembly, int startingOffset, int startingLine, int endingOffset, int endingLine, char[] fn); public IASTNamespaceDefinition createNamespaceDefinition( IASTScope scope, - String identifier, + char[] identifier, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLineNumber, char[] fn) throws ASTSemanticException; public IASTNamespaceAlias createNamespaceAlias( IASTScope scope, - String identifier, + char[] identifier, ITokenDuple alias, int startingOffset, int startingLine, @@ -72,7 +72,7 @@ public interface IASTFactory public IASTLinkageSpecification createLinkageSpecification( IASTScope scope, - String spec, int startingOffset, int startingLine, char[] fn) ; + char[] spec, int startingOffset, int startingLine, char[] fn) ; public IASTClassSpecifier createClassSpecifier( IASTScope scope, @@ -103,12 +103,12 @@ public interface IASTFactory public IASTEnumerationSpecifier createEnumerationSpecifier( IASTScope scope, - String name, + char[] name, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, char[] fn) throws ASTSemanticException; public IASTEnumerator addEnumerator( IASTEnumerationSpecifier enumeration, - String string, + char[] string, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endingOffset, int endLine, IASTExpression initialValue, char[] fn)throws ASTSemanticException; @@ -119,7 +119,7 @@ public interface IASTFactory IASTExpression rhs, IASTExpression thirdExpression, IASTTypeId typeId, - ITokenDuple idExpression, String literal, IASTNewExpressionDescriptor newDescriptor) throws ASTSemanticException; + ITokenDuple idExpression, char[] literal, IASTNewExpressionDescriptor newDescriptor) throws ASTSemanticException; public IASTExpression.IASTNewExpressionDescriptor createNewDescriptor(List newPlacementExpressions,List newTypeIdExpressions,List newInitializerExpressions); @@ -207,24 +207,24 @@ public interface IASTFactory public IASTDesignator createDesignator( IASTDesignator.DesignatorKind kind, IASTExpression constantExpression, IToken fieldIdentifier, Map extensionParms ); - public IASTParameterDeclaration createParameterDeclaration( boolean isConst, boolean isVolatile, IASTTypeSpecifier getTypeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endingOffset, int endingLine, char[] fn ) ; + public IASTParameterDeclaration createParameterDeclaration( boolean isConst, boolean isVolatile, IASTTypeSpecifier getTypeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, char[] parameterName, IASTInitializerClause initializerClause, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endingOffset, int endingLine, char[] fn ) ; public IASTTemplateDeclaration createTemplateDeclaration( IASTScope scope, List templateParameters, boolean exported, int startingOffset, int startingLine, char[] fn ) throws ASTSemanticException; - public IASTTemplateParameter createTemplateParameter( IASTTemplateParameter.ParamKind kind, String identifier, IASTTypeId defaultValue, IASTParameterDeclaration parameter, List parms, IASTCodeScope parameterScope, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endingOffset, int endingLine, char[] fn ) throws ASTSemanticException; + public IASTTemplateParameter createTemplateParameter( IASTTemplateParameter.ParamKind kind, char[] identifier, IASTTypeId defaultValue, IASTParameterDeclaration parameter, List parms, IASTCodeScope parameterScope, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endingOffset, int endingLine, char[] fn ) throws ASTSemanticException; public IASTTemplateInstantiation createTemplateInstantiation(IASTScope scope, int startingOffset, int startingLine, char[] fn); public IASTTemplateSpecialization createTemplateSpecialization(IASTScope scope, int startingOffset, int startingLine, char[] fn); - public IASTTypedefDeclaration createTypedef( IASTScope scope, String name, IASTAbstractDeclaration mapping, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, char[] fn ) throws ASTSemanticException; + public IASTTypedefDeclaration createTypedef( IASTScope scope, char[] name, IASTAbstractDeclaration mapping, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, char[] fn ) throws ASTSemanticException; public IASTAbstractTypeSpecifierDeclaration createTypeSpecDeclaration( IASTScope scope, IASTTypeSpecifier typeSpecifier, IASTTemplate template, int startingOffset, int startingLine, int endingOffset, int endingLine, boolean isFriend, char[] fn ); public boolean queryIsTypeName( IASTScope scope, ITokenDuple nameInQuestion ) ; - static final String DOUBLE_COLON = "::"; //$NON-NLS-1$ - static final String TELTA = "~"; //$NON-NLS-1$ + static final char[] DOUBLE_COLON = new char[] { ':', ':' }; + static final char[] TELTA = new char[] { '~' }; /** * @param scope * @return @@ -232,7 +232,7 @@ public interface IASTFactory public IASTCodeScope createNewCodeBlock(IASTScope scope); public IASTTypeId createTypeId( IASTScope scope, IASTSimpleTypeSpecifier.Type kind, boolean isConst, boolean isVolatile, boolean isShort, - boolean isLong, boolean isSigned, boolean isUnsigned, boolean isTypename, ITokenDuple name, List pointerOps, List arrayMods, String completeSignature ) throws ASTSemanticException; + boolean isLong, boolean isSigned, boolean isUnsigned, boolean isTypename, ITokenDuple name, List pointerOps, List arrayMods, char[] completeSignature ) throws ASTSemanticException; /** * @param astClassSpecifier */ diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTOffsetableNamedElement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTOffsetableNamedElement.java index 7e7668da606..166475b32c4 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTOffsetableNamedElement.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTOffsetableNamedElement.java @@ -18,6 +18,7 @@ package org.eclipse.cdt.core.parser.ast; public interface IASTOffsetableNamedElement extends IASTOffsetableElement { public String getName(); + public char[] getNameCharArray(); public int getNameOffset(); public void setNameOffset( int o ); public int getNameEndOffset(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/extension/IASTFactoryExtension.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/extension/IASTFactoryExtension.java index 5caf91ecdf5..43a7d3a784b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/extension/IASTFactoryExtension.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/extension/IASTFactoryExtension.java @@ -41,7 +41,7 @@ public interface IASTFactoryExtension { IASTExpression thirdExpression, IASTTypeId typeId, ITokenDuple idExpression, - String literal, + char[] literal, IASTNewExpressionDescriptor newDescriptor, List references); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ContextualParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ContextualParser.java index cc6eba353b7..02c67d96c9c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ContextualParser.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ContextualParser.java @@ -78,7 +78,7 @@ public class ContextualParser extends CompleteParser { * @return */ protected String getCompletionPrefix() { - return ( finalToken == null ? EMPTY_STRING : finalToken.getImage() ); + return ( finalToken == null ? String.valueOf(EMPTY_STRING) : finalToken.getImage() ); } /** @@ -162,7 +162,7 @@ public class ContextualParser extends CompleteParser { setCompletionFunctionName(); } - private String currentFunctionName = EMPTY_STRING; + private String currentFunctionName = String.valueOf(EMPTY_STRING); protected IASTExpression parameterListExpression; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java index d843587b1d1..55d46afa730 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java @@ -432,7 +432,7 @@ public class DeclarationWrapper implements IDeclaratorOwner ITokenDuple nameDuple = ( d.getPointerOperatorNameDuple() != null ) ? TokenFactory.createTokenDuple( d.getPointerOperatorNameDuple(), d.getNameDuple() ) : d.getNameDuple(); if( isTypedef() ) - return astFactory.createTypedef(scope, nameDuple.toString(), abs, + return astFactory.createTypedef(scope, nameDuple.toCharArray(), abs, getStartingOffset(), getStartingLine(), d .getNameStartOffset(), d.getNameEndOffset(), d .getNameLine(), fn); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Declarator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Declarator.java index 8a4258b022e..e6792d4fd0c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Declarator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Declarator.java @@ -32,7 +32,7 @@ import org.eclipse.cdt.internal.core.parser.ast.EmptyIterator; public class Declarator implements IParameterCollection, IDeclaratorOwner, IDeclarator { private static final int DEFAULT_ARRAYLIST_SIZE = 4; - private static final String EMPTY_STRING = ""; //$NON-NLS-1$ + private static final char[] EMPTY_STRING = new char[0]; //$NON-NLS-1$ private final IDeclaratorOwner owner; private ITokenDuple pointerOperatorNameDuple = null; @@ -79,10 +79,10 @@ public class Declarator implements IParameterCollection, IDeclaratorOwner, IDecl /** * @return */ - public String getName() + public char[] getName() { if( namedDuple == null ) return EMPTY_STRING; - return namedDuple.toString(); + return namedDuple.toCharArray(); } /** diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ExpressionParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ExpressionParser.java index aac623b0b65..9a13d68eead 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ExpressionParser.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ExpressionParser.java @@ -50,7 +50,7 @@ import org.eclipse.cdt.internal.core.parser.util.TraceUtil; */ public class ExpressionParser implements IExpressionParser, IParserData { - protected static final String EMPTY_STRING = ""; //$NON-NLS-1$ + protected static final char[] EMPTY_STRING = "".toCharArray(); //$NON-NLS-1$ private static int FIRST_ERROR_UNSET = -1; protected boolean parsePassed = true; protected int firstErrorOffset = FIRST_ERROR_UNSET; @@ -1707,13 +1707,12 @@ public class ExpressionParser implements IExpressionParser, IParserData { endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0; try { - String signature = "";//$NON-NLS-1$ + char[] signature = EMPTY_STRING; if (last != null) { if( lastToken == null ) lastToken = last; - signature = TokenFactory.createStringRepresentation(mark, - last); + signature = TokenFactory.createCharArrayRepresentation(mark, last); } return astFactory.createTypeId(scope, kind, isConst, isVolatile, isShort, isLong, isSigned, isUnsigned, isTypename, name, id @@ -1957,7 +1956,7 @@ public class ExpressionParser implements IExpressionParser, IParserData { if (LT(1) == IToken.tLPAREN) { consume(IToken.tLPAREN); setCurrentFunctionName(((typeId != null) ? typeId - .getFullSignature() : EMPTY_STRING)); + .getFullSignature() : String.valueOf(EMPTY_STRING))); setCompletionValues(scope, CompletionKind.CONSTRUCTOR_REFERENCE); if (templateIdScopes != null) { templateIdScopes.push(new Integer(IToken.tLPAREN)); @@ -1968,7 +1967,7 @@ public class ExpressionParser implements IExpressionParser, IParserData { newInitializerExpressions.add(expression(scope, CompletionKind.CONSTRUCTOR_REFERENCE, key)); - setCurrentFunctionName(EMPTY_STRING); + setCurrentFunctionName(String.valueOf(EMPTY_STRING)); consume(IToken.tRPAREN); if (templateIdScopes != null) { templateIdScopes.pop(); @@ -2317,7 +2316,7 @@ public class ExpressionParser implements IExpressionParser, IParserData { CompletionKind.FUNCTION_REFERENCE, context); secondExpression = expression(scope, CompletionKind.FUNCTION_REFERENCE, key); - setCurrentFunctionName(EMPTY_STRING); + setCurrentFunctionName(String.valueOf(EMPTY_STRING)); endOffset = consume(IToken.tRPAREN).getEndOffset(); if (templateIdScopes != null) { templateIdScopes.pop(); @@ -2483,7 +2482,7 @@ public class ExpressionParser implements IExpressionParser, IParserData { setCurrentFunctionName(typeName); IASTExpression inside = expression(scope, CompletionKind.CONSTRUCTOR_REFERENCE, key); - setCurrentFunctionName(EMPTY_STRING); + setCurrentFunctionName(String.valueOf(EMPTY_STRING)); int endOffset = consume(IToken.tRPAREN).getEndOffset(); try { return astFactory.createExpression(scope, type, inside, null, null, @@ -2513,7 +2512,7 @@ public class ExpressionParser implements IExpressionParser, IParserData { try { return astFactory.createExpression(scope, IASTExpression.Kind.PRIMARY_INTEGER_LITERAL, null, - null, null, null, null, t.getImage(), null); + null, null, null, null, t.getCharImage(), null); } catch (ASTSemanticException e1) { throwBacktrack(e1.getProblem()); } catch (Exception e) { @@ -2525,7 +2524,7 @@ public class ExpressionParser implements IExpressionParser, IParserData { try { return astFactory.createExpression(scope, IASTExpression.Kind.PRIMARY_FLOAT_LITERAL, null, - null, null, null, null, t.getImage(), null); + null, null, null, null, t.getCharImage(), null); } catch (ASTSemanticException e2) { throwBacktrack(e2.getProblem()); } catch (Exception e) { @@ -2538,7 +2537,7 @@ public class ExpressionParser implements IExpressionParser, IParserData { try { return astFactory.createExpression(scope, IASTExpression.Kind.PRIMARY_STRING_LITERAL, null, - null, null, null, null, t.getImage(), null); + null, null, null, null, t.getCharImage(), null); } catch (ASTSemanticException e5) { throwBacktrack(e5.getProblem()); } catch (Exception e) { @@ -2552,7 +2551,7 @@ public class ExpressionParser implements IExpressionParser, IParserData { try { return astFactory.createExpression(scope, IASTExpression.Kind.PRIMARY_BOOLEAN_LITERAL, null, - null, null, null, null, t.getImage(), null); + null, null, null, null, t.getCharImage(), null); } catch (ASTSemanticException e3) { throwBacktrack(e3.getProblem()); } catch (Exception e) { @@ -2567,7 +2566,7 @@ public class ExpressionParser implements IExpressionParser, IParserData { try { return astFactory.createExpression(scope, IASTExpression.Kind.PRIMARY_CHAR_LITERAL, null, - null, null, null, null, t.getImage(), null); + null, null, null, null, t.getCharImage(), null); } catch (ASTSemanticException e4) { throwBacktrack(e4.getProblem()); } catch (Exception e) { 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 2819fa9db4a..de8adac444f 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 @@ -41,7 +41,7 @@ import org.eclipse.cdt.internal.core.parser.Parser.Flags; */ public class GCCParserExtension implements IParserExtension { - private static final String EMPTY_STRING = "";//$NON-NLS-1$ + private static final char[] EMPTY_STRING = "".toCharArray();//$NON-NLS-1$ /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.extension.IParserExtension#isValidCVModifier(org.eclipse.cdt.core.parser.ParserLanguage, int) */ 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 72af7fa2cdb..b166e73629a 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 @@ -409,7 +409,7 @@ public abstract class Parser extends ExpressionParser implements IParser linkage = astFactory.createLinkageSpecification( scope, - spec.getImage(), + spec.getCharImage(), firstToken.getOffset(), firstToken.getLineNumber(), firstToken.getFilename()); } catch (Exception e) @@ -457,7 +457,7 @@ public abstract class Parser extends ExpressionParser implements IParser linkage = astFactory.createLinkageSpecification( scope, - spec.getImage(), + spec.getCharImage(), firstToken.getOffset(), firstToken.getLineNumber(), firstToken.getFilename()); } catch (Exception e) @@ -667,7 +667,7 @@ public abstract class Parser extends ExpressionParser implements IParser returnValue.add( astFactory.createTemplateParameter( kind, - ( id == null )? "" : id.getImage(), //$NON-NLS-1$ + ( id == null )? EMPTY_STRING : id.getCharImage(), //$NON-NLS-1$ typeId, null, null, @@ -717,7 +717,7 @@ public abstract class Parser extends ExpressionParser implements IParser returnValue.add( astFactory.createTemplateParameter( IASTTemplateParameter.ParamKind.TEMPLATE_LIST, - ( optionalId == null )? "" : optionalId.getImage(), //$NON-NLS-1$ + ( optionalId == null )? EMPTY_STRING : optionalId.getCharImage(), //$NON-NLS-1$ optionalTypeId, null, subResult, @@ -825,7 +825,7 @@ public abstract class Parser extends ExpressionParser implements IParser IToken first = consume(IToken.t_asm); setCompletionValues( scope, CompletionKind.NO_SUCH_KIND, KeywordSetKey.EMPTY ); consume(IToken.tLPAREN); - String assembly = consume(IToken.tSTRING).getImage(); + char[] assembly = consume(IToken.tSTRING).getCharImage(); consume(IToken.tRPAREN); IToken last = consume(IToken.tSEMI); @@ -982,7 +982,7 @@ public abstract class Parser extends ExpressionParser implements IParser namespaceDefinition = astFactory.createNamespaceDefinition( scope, - (identifier == null ? "" : identifier.getImage()), //$NON-NLS-1$ + (identifier == null ? EMPTY_STRING: identifier.getCharImage()), //$NON-NLS-1$ first.getOffset(), first.getLineNumber(), (identifier == null ? first.getOffset() : identifier.getOffset()), @@ -1050,7 +1050,7 @@ public abstract class Parser extends ExpressionParser implements IParser try { alias = astFactory.createNamespaceAlias( - scope, identifier.getImage(), duple, first.getOffset(), + scope, identifier.getCharImage(), duple, first.getOffset(), first.getLineNumber(), identifier.getOffset(), identifier.getEndOffset(), identifier.getLineNumber(), duple.getLastToken().getEndOffset(), duple.getLastToken().getLineNumber() ); } catch (Exception e1) @@ -2613,7 +2613,7 @@ public abstract class Parser extends ExpressionParser implements IParser try { enumeration = astFactory.createEnumerationSpecifier(sdw .getScope(), ((identifier == null) - ? "" : identifier.getImage()), //$NON-NLS-1$ + ? EMPTY_STRING : identifier.getCharImage()), //$NON-NLS-1$ mark.getOffset(), mark.getLineNumber(), ((identifier == null) ? mark.getOffset() : identifier .getOffset()), ((identifier == null) ? mark @@ -2649,7 +2649,7 @@ public abstract class Parser extends ExpressionParser implements IParser if (LT(1) == IToken.tRBRACE) { try { enumerator = astFactory.addEnumerator(enumeration, - enumeratorIdentifier.getImage(), + enumeratorIdentifier.getCharImage(), enumeratorIdentifier.getOffset(), enumeratorIdentifier.getLineNumber(), enumeratorIdentifier.getOffset(), @@ -2678,7 +2678,7 @@ public abstract class Parser extends ExpressionParser implements IParser } try { enumerator = astFactory.addEnumerator(enumeration, - enumeratorIdentifier.getImage(), + enumeratorIdentifier.getCharImage(), enumeratorIdentifier.getOffset(), enumeratorIdentifier.getLineNumber(), enumeratorIdentifier.getOffset(), diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ParserProblemFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ParserProblemFactory.java index 6c76ef79c39..108592167c1 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ParserProblemFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ParserProblemFactory.java @@ -32,7 +32,7 @@ public class ParserProblemFactory extends BaseProblemFactory int end, int line, char[] file, - String arg, + char[] arg, boolean warn, boolean error) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTInclusion.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTInclusion.java index fbe7db0f9a6..1b6e05df4b0 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTInclusion.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTInclusion.java @@ -20,7 +20,7 @@ import org.eclipse.cdt.core.parser.ast.IReferenceManager; */ public class ASTInclusion implements IASTInclusion { - public ASTInclusion( String name, String fileName, boolean local, int startingOffset, int startLine, int nameOffset, int nameEndOffset, int nameLine, int endOffset, int endLine, char [] fn ) + public ASTInclusion( char[] name, char[] fileName, boolean local, int startingOffset, int startLine, int nameOffset, int nameEndOffset, int nameLine, int endOffset, int endLine, char [] fn ) { this.name = name; this.fileName = fileName; @@ -33,20 +33,23 @@ public class ASTInclusion implements IASTInclusion { } private int nameEndOffset; - private final String name, fileName; + private final char[] name, fileName; private final boolean local; /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTInclusion#getName() */ public String getName() { - return name; + return String.valueOf(name); + } + public char[] getNameCharArray(){ + return name; } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTInclusion#getFullFileName() */ public String getFullFileName() { - return fileName; + return String.valueOf(fileName); } /* (non-Javadoc) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTMacro.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTMacro.java index 7c5aa5287e6..855ede8255d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTMacro.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTMacro.java @@ -24,11 +24,11 @@ import org.eclipse.cdt.core.parser.ast.IReferenceManager; public class ASTMacro implements IASTMacro { private int nameEndOffset = 0; - private final String name; + private final char[] name; private final IMacroDescriptor innerMacro; private final char[] fn; - public ASTMacro( String name, IMacroDescriptor info, int start, int startLine, int nameBeg, int nameEnd, int nameLine, int end, int endLine, char[] fn ) + public ASTMacro( char[] name, IMacroDescriptor info, int start, int startLine, int nameBeg, int nameEnd, int nameLine, int end, int endLine, char[] fn ) { this.name =name; setStartingOffsetAndLineNumber(start, startLine); @@ -45,7 +45,11 @@ public class ASTMacro implements IASTMacro { * @see org.eclipse.cdt.core.parser.ast.IASTMacro#getName() */ public String getName() { - return name; + return String.valueOf(name); + } + public char[] getNameCharArray(){ + return name; + } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IOffsetableElementRW#setStartingOffset(int) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java index a4dc2c8b075..7194b426347 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java @@ -44,7 +44,7 @@ public class BaseASTFactory { /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.ast.IASTFactory#createMacro(java.lang.String, int, int, int) */ - public IASTMacro createMacro(String name, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endingOffset, int endingLine, IMacroDescriptor info, char[] fn) { + public IASTMacro createMacro(char[] name, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endingOffset, int endingLine, IMacroDescriptor info, char[] fn) { IASTMacro m = new ASTMacro( name, info, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, endingOffset, endingLine, fn ); return m; } @@ -52,7 +52,7 @@ public class BaseASTFactory { /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.ast.IASTFactory#createInclusion(java.lang.String, java.lang.String, boolean) */ - public IASTInclusion createInclusion(String name, String fileName, boolean local, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endingOffset, int endingLine, char[] fn) { + public IASTInclusion createInclusion(char[] name, char[] fileName, boolean local, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endingOffset, int endingLine, char[] fn) { IASTInclusion inclusion = new ASTInclusion( name, fileName, local, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, endingOffset, endingLine, fn ); return inclusion; } @@ -81,6 +81,7 @@ public class BaseASTFactory { } protected final IASTFactoryExtension extension; + protected static final char[] EMPTY_STRING = new char[0]; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTClassSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTClassSpecifier.java index bdc724024c6..6d061d7b23e 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTClassSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTClassSpecifier.java @@ -148,7 +148,7 @@ public class ASTClassSpecifier extends ASTScope implements IASTClassSpecifier { return String.valueOf(symbol.getName()); } - public char[] getNameArray(){ + public char[] getNameCharArray(){ return symbol.getName(); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTElaboratedTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTElaboratedTypeSpecifier.java index 84e9be17f1d..f65971d4226 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTElaboratedTypeSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTElaboratedTypeSpecifier.java @@ -57,7 +57,7 @@ public class ASTElaboratedTypeSpecifier extends ASTSymbol implements IASTElabora { return String.valueOf(getSymbol().getName()); } - public char[] getNameArray(){ + public char[] getNameCharArray(){ return getSymbol().getName(); } /* (non-Javadoc) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumerationSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumerationSpecifier.java index 7b59ac8ac54..af201796bd4 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumerationSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumerationSpecifier.java @@ -111,6 +111,12 @@ public class ASTEnumerationSpecifier { return String.valueOf(getSymbol().getName()); } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameCharArray() + */ + public char[] getNameCharArray(){ + return getSymbol().getName(); + } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement#getFullyQualifiedName() */ diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumerator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumerator.java index e673738b59a..a7d67fc042f 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumerator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumerator.java @@ -179,4 +179,11 @@ public class ASTEnumerator extends ASTSymbol implements IASTEnumerator { nameEndOffset = offset; } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameCharArray() + */ + public char[] getNameCharArray() { + return symbol.getName(); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTFunction.java index 0d279799d2d..45cca2ce45c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTFunction.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTFunction.java @@ -388,4 +388,11 @@ public class ASTFunction extends ASTScope implements IASTFunction nameEndOffset = offset; nameLineNumber = lineNumber; } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameCharArray() + */ + public char[] getNameCharArray() { + return symbol.getName(); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceAlias.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceAlias.java index d0928a982ac..ba768119269 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceAlias.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceAlias.java @@ -181,4 +181,11 @@ public class ASTNamespaceAlias extends ASTSymbol implements IASTNamespaceAlias nameEndOffset = offset; nameLineNumber = lineNumber; } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameCharArray() + */ + public char[] getNameCharArray() { + return getSymbol().getName(); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceDefinition.java index 58ecde9af96..6b5cb7f0147 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceDefinition.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceDefinition.java @@ -211,4 +211,11 @@ public class ASTNamespaceDefinition nameEndOffset = offset; nameLineNumber = lineNumber; } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameCharArray() + */ + public char[] getNameCharArray() { + return symbol.getName(); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTParameterDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTParameterDeclaration.java index 136aaae16ce..7bb82dca8ff 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTParameterDeclaration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTParameterDeclaration.java @@ -70,7 +70,7 @@ public class ASTParameterDeclaration extends ASTSymbol implements IASTParameterD { return String.valueOf(parameterName); } - public char[] getNameArray(){ + public char[] getNameCharArray(){ return parameterName; } /* (non-Javadoc) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTProblemFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTProblemFactory.java index 82422f9e0ba..25b4c80de1a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTProblemFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTProblemFactory.java @@ -26,7 +26,7 @@ public class ASTProblemFactory extends BaseProblemFactory implements IProblemFac * @see org.eclipse.cdt.internal.core.parser.problem.IProblemFactory#createProblem(int, int, int, int, char[], java.util.Map, boolean, boolean) */ public IProblem createProblem(int id, int start, int end, int line, - char[] file, String arg, boolean warn, boolean error) { + char[] file, char[] arg, boolean warn, boolean error) { if( checkBitmask( id, IProblem.INTERNAL_RELATED ) ) return createInternalProblem( id, start, end, line, file, arg, warn, error ); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTemplateParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTemplateParameter.java index c52bf4de5ca..6a694a3f667 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTemplateParameter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTemplateParameter.java @@ -136,7 +136,7 @@ public class ASTTemplateParameter extends ASTSymbol implements IASTTemplateParam public String getName() { return String.valueOf(symbol.getName()); } - public char[] getNameArray(){ + public char[] getNameCharArray(){ return symbol.getName(); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypedef.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypedef.java index 17e2971c395..84c2f61abd3 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypedef.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypedef.java @@ -222,4 +222,11 @@ public class ASTTypedef extends ASTSymbol implements IASTTypedefDeclaration nameEndOffset = offset; nameLineNumber = lineNumber; } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameCharArray() + */ + public char[] getNameCharArray() { + return getSymbol().getName(); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTVariable.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTVariable.java index e869193f0fc..9502dd36ebb 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTVariable.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTVariable.java @@ -276,4 +276,11 @@ public class ASTVariable extends ASTSymbol implements IASTVariable nameEndOffset = offset; nameLineNumber = lineNumber; } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameCharArray() + */ + public char[] getNameCharArray() { + return getSymbol().getName(); + } } 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 5dbe9bac519..a318cb8c9f2 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 @@ -116,7 +116,6 @@ import org.eclipse.cdt.internal.core.parser.util.TraceUtil; */ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFactory { - protected static final char[] EMPTY_STRING = new char[0]; //$NON-NLS-1$ protected static final char[] THIS = new char[] { 't', 'h', 'i', 's' }; private final static ITypeInfo.OperatorExpression SUBSCRIPT; private final static IProblemFactory problemFactory = new ASTProblemFactory(); @@ -328,7 +327,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto else return null; case 1: - image = name.extractNameFromTemplateId().toCharArray(); + image = name.extractNameFromTemplateId(); args = ( templateArgLists != null ) ? getTemplateArgList( templateArgLists[ 0 ] ) : null; result = lookupElement(startingScope, image, type, parameters, args, lookup ); @@ -607,18 +606,18 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto */ public IASTASMDefinition createASMDefinition( IASTScope scope, - String assembly, + char[] assembly, int startingOffset, int startingLine, int endingOffset, int endingLine, char[] fn) { - return new ASTASMDefinition( scopeToSymbol(scope), assembly.toCharArray(), startingOffset, startingLine, endingOffset, endingLine, fn); + return new ASTASMDefinition( scopeToSymbol(scope), assembly, startingOffset, startingLine, endingOffset, endingLine, fn); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createNamespaceDefinition(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, int, int) */ public IASTNamespaceDefinition createNamespaceDefinition( IASTScope scope, - String identifier, + char[] identifier, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLineNumber, char[] fn) throws ASTSemanticException { @@ -630,22 +629,22 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto { try { - namespaceSymbol = pstScope.qualifiedLookup( identifier.toCharArray() ); + namespaceSymbol = pstScope.qualifiedLookup( identifier ); } catch (ParserSymbolTableException e) { - handleProblem( e.createProblemID(), identifier.toCharArray(), nameOffset, nameEndOffset, nameLineNumber, true ); + handleProblem( e.createProblemID(), identifier, nameOffset, nameEndOffset, nameLineNumber, true ); } } if( namespaceSymbol != null ) { if( namespaceSymbol.getType() != ITypeInfo.t_namespace ) - handleProblem( IProblem.SEMANTIC_INVALID_OVERLOAD, identifier.toCharArray(), nameOffset, nameEndOffset, nameLineNumber, true ); + handleProblem( IProblem.SEMANTIC_INVALID_OVERLOAD, identifier, nameOffset, nameEndOffset, nameLineNumber, true ); } else { - namespaceSymbol = pst.newContainerSymbol( identifier.toCharArray(), ITypeInfo.t_namespace ); + namespaceSymbol = pst.newContainerSymbol( identifier, ITypeInfo.t_namespace ); if( identifier.equals( EMPTY_STRING ) ) namespaceSymbol.setContainingSymbol( pstScope ); else @@ -724,10 +723,10 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto */ public IASTLinkageSpecification createLinkageSpecification( IASTScope scope, - String spec, + char[] spec, int startingOffset, int startingLine, char[] fn) { - return new ASTLinkageSpecification( scopeToSymbol( scope ), spec.toCharArray(), startingOffset, startingLine, fn ); + return new ASTLinkageSpecification( scopeToSymbol( scope ), spec, startingOffset, startingLine, fn ); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createClassSpecifier(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, org.eclipse.cdt.core.parser.ast.ASTClassKind, org.eclipse.cdt.core.parser.ast.IASTClassSpecifier.ClassNameType, org.eclipse.cdt.core.parser.ast.ASTAccessVisibility, org.eclipse.cdt.core.parser.ast.IASTTemplate, int, int) @@ -883,7 +882,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto */ protected void handleProblem( IASTScope scope, int id, char[] attribute, int startOffset, int endOffset, int lineNumber, boolean isError ) throws ASTSemanticException { IProblem p = problemFactory.createProblem( id, - startOffset, endOffset, lineNumber, filename, attribute != null ? String.valueOf(attribute) : null, !isError, isError ); + startOffset, endOffset, lineNumber, filename, attribute, !isError, isError ); TraceUtil.outputTrace(logService, "CompleteParseASTFactory - IProblem : ", p, null, null, null ); //$NON-NLS-1$ @@ -1049,7 +1048,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto */ public IASTEnumerationSpecifier createEnumerationSpecifier( IASTScope scope, - String name, + char[] name, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, char[] fn) throws ASTSemanticException { @@ -1057,14 +1056,14 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto IContainerSymbol containerSymbol = scopeToSymbol(scope); ITypeInfo.eType pstType = ITypeInfo.t_enumeration; - IDerivableContainerSymbol classSymbol = pst.newDerivableContainerSymbol( name.toCharArray(), pstType ); + IDerivableContainerSymbol classSymbol = pst.newDerivableContainerSymbol( name, pstType ); try { containerSymbol.addSymbol( classSymbol ); } catch (ParserSymbolTableException e) { - handleProblem( e.createProblemID(), name.toCharArray() ); + handleProblem( e.createProblemID(), name ); } ASTEnumerationSpecifier enumSpecifier = new ASTEnumerationSpecifier( classSymbol, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, fn ); @@ -1084,7 +1083,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto */ public IASTEnumerator addEnumerator( IASTEnumerationSpecifier enumeration, - String name, + char[] name, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endingOffset, int endLine, IASTExpression initialValue, char[] fn) throws ASTSemanticException @@ -1092,7 +1091,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto setFilename(fn); IContainerSymbol enumerationSymbol = (IContainerSymbol)((ISymbolOwner)enumeration).getSymbol(); - ISymbol enumeratorSymbol = pst.newSymbol( name.toCharArray(), ITypeInfo.t_enumerator ); + ISymbol enumeratorSymbol = pst.newSymbol( name, ITypeInfo.t_enumerator ); try { enumerationSymbol.addSymbol( enumeratorSymbol ); @@ -1100,7 +1099,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto catch (ParserSymbolTableException e1) { if( e1.reason == ParserSymbolTableException.r_InvalidOverload ) - handleProblem( IProblem.SEMANTIC_INVALID_OVERLOAD, name.toCharArray(), startingOffset, endingOffset, startingLine, true ); + handleProblem( IProblem.SEMANTIC_INVALID_OVERLOAD, name, startingOffset, endingOffset, startingLine, true ); // assert false : e1; } ASTEnumerator enumerator = new ASTEnumerator( enumeratorSymbol, enumeration, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, endingOffset, endLine, initialValue, fn ); @@ -1118,7 +1117,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto IASTExpression rhs, IASTExpression thirdExpression, IASTTypeId typeId, - ITokenDuple idExpression, String literal, IASTNewExpressionDescriptor newDescriptor) throws ASTSemanticException + ITokenDuple idExpression, char[] literal, IASTNewExpressionDescriptor newDescriptor) throws ASTSemanticException { setFilename( idExpression ); if( idExpression != null ) @@ -1140,7 +1139,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto null, kind.getKindName(), " literal=", //$NON-NLS-1$ - literal + String.valueOf(literal) ); } @@ -1573,7 +1572,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto IASTExpression rhs, IASTExpression thirdExpression, IASTTypeId typeId, - String literal, + char[] literal, ISymbol symbol) throws ASTSemanticException { ITypeInfo info = null; @@ -1600,8 +1599,8 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto //types that need a pointer if( kind == IASTExpression.Kind.PRIMARY_STRING_LITERAL || - (literal.length() > 1 && ( kind == IASTExpression.Kind.PRIMARY_CHAR_LITERAL || - kind == IASTExpression.Kind.POSTFIX_SIMPLETYPE_CHAR )) ) + (literal.length > 1 && ( kind == IASTExpression.Kind.PRIMARY_CHAR_LITERAL || + kind == IASTExpression.Kind.POSTFIX_SIMPLETYPE_CHAR )) ) { info.addPtrOperator(new ITypeInfo.PtrOp(ITypeInfo.PtrOp.t_pointer)); } @@ -2178,7 +2177,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto } } - IParameterizedSymbol symbol = pst.newParameterizedSymbol( name.extractNameFromTemplateId().toCharArray(), ITypeInfo.t_function ); + IParameterizedSymbol symbol = pst.newParameterizedSymbol( name.extractNameFromTemplateId(), ITypeInfo.t_function ); setFunctionTypeInfoBits(isInline, isFriend, isStatic, symbol); symbol.setHasVariableArgs( hasVariableArguments ); @@ -2197,7 +2196,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto while (p.hasNext()){ ASTParameterDeclaration param = (ASTParameterDeclaration)p.next(); if( param.getSymbol() == null ) - handleProblem( IProblem.SEMANTICS_RELATED, param.getNameArray(), param.getNameOffset(), param.getEndingOffset(), param.getStartingLine(), true ); + handleProblem( IProblem.SEMANTICS_RELATED, param.getNameCharArray(), param.getNameOffset(), param.getEndingOffset(), param.getStartingLine(), true ); functionParameters.add(param.getSymbol().getTypeInfo()); } @@ -2358,12 +2357,12 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto newReferences.add( cache.getReference(r.getOffset(), r.getReferencedElement())); } if( xrefSymbol != null ) - addReference( newReferences, createReference( xrefSymbol, elab.getNameArray(), elab.getNameOffset()) ); + addReference( newReferences, createReference( xrefSymbol, elab.getNameCharArray(), elab.getNameOffset()) ); } char[] paramName = EMPTY_STRING; if(absDecl instanceof IASTParameterDeclaration){ - paramName = ((ASTParameterDeclaration)absDecl).getNameArray(); + paramName = ((ASTParameterDeclaration)absDecl).getNameCharArray(); } ISymbol paramSymbol = pst.newSymbol( paramName, type ); @@ -2502,7 +2501,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto //template-id? if( nameDuple.getTemplateIdArgLists() != null ){ templateIdArgList = nameDuple.getTemplateIdArgLists()[ 0 ]; - methodName = nameDuple.extractNameFromTemplateId().toCharArray(); + methodName = nameDuple.extractNameFromTemplateId(); } else { methodName = nameDuple.toCharArray(); } @@ -2523,12 +2522,12 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto } else { classifier = (IASTClassSpecifier) scope; } - char[] parentName = ((ASTClassSpecifier)classifier).getNameArray(); + char[] parentName = ((ASTClassSpecifier)classifier).getNameCharArray(); // check constructor / destructor if no return type if ( returnType.getTypeSpecifier() == null ){ - if(CharArrayUtils.indexOf( DOUBLE_COLON.toCharArray(), parentName ) != -1){ - parentName = CharArrayUtils.lastSegment( parentName, DOUBLE_COLON.toCharArray() ); + if(CharArrayUtils.indexOf( DOUBLE_COLON, parentName ) != -1){ + parentName = CharArrayUtils.lastSegment( parentName, DOUBLE_COLON ); } if( CharArrayUtils.equals( parentName, methodName) ){ isConstructor = true; @@ -2551,7 +2550,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto while (p.hasNext()){ ASTParameterDeclaration param = (ASTParameterDeclaration)p.next(); if( param.getSymbol() == null ) - handleProblem( IProblem.SEMANTICS_RELATED, param.getNameArray(), param.getNameOffset(), param.getEndingOffset(), param.getNameLineNumber(), true ); + handleProblem( IProblem.SEMANTICS_RELATED, param.getNameCharArray(), param.getNameOffset(), param.getEndingOffset(), param.getNameLineNumber(), true ); functionParameters.add(param.getSymbol().getTypeInfo()); } @@ -2895,7 +2894,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto symbolToBeCloned = pst.newSymbol(name, ITypeInfo.t_type); symbolToBeCloned.setTypeSymbol(elab.getSymbol()); if( elab.getSymbol() != null && references != null ) - addReference( references, createReference( elab.getSymbol(), elab.getNameArray(), elab.getNameOffset()) ); + addReference( references, createReference( elab.getSymbol(), elab.getNameCharArray(), elab.getNameOffset()) ); } else if ( abstractDeclaration.getTypeSpecifier() instanceof ASTEnumerationSpecifier ) { @@ -3032,7 +3031,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto try { template.addTemplateParameter( param.getSymbol() ); } catch (ParserSymbolTableException e) { - handleProblem( e.createProblemID(), param.getNameArray(), startingOffset, -1, startingLine, true ); + handleProblem( e.createProblemID(), param.getNameCharArray(), startingOffset, -1, startingLine, true ); } } @@ -3047,7 +3046,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto */ public IASTTemplateParameter createTemplateParameter( ParamKind kind, - String identifier, + char[] identifier, IASTTypeId defaultValue, IASTParameterDeclaration parameter, List parms, @@ -3067,7 +3066,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto } } if( kind == ParamKind.TEMPLATE_LIST ){ - ITemplateSymbol template = pst.newTemplateSymbol( identifier.toCharArray() ); + ITemplateSymbol template = pst.newTemplateSymbol( identifier ); provider.setType( ITypeInfo.t_templateParameter ); provider.setTemplateParameterType( ITypeInfo.t_template ); template.setTypeInfo( provider.completeConstruction() ); @@ -3077,19 +3076,19 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto try { template.addTemplateParameter( param.getSymbol() ); } catch (ParserSymbolTableException e) { - handleProblem( e.createProblemID(), param.getNameArray(), param.getStartingOffset(), param.getEndingOffset(), param.getStartingLine(), true ); //$NON-NLS-1$ + handleProblem( e.createProblemID(), param.getNameCharArray(), param.getStartingOffset(), param.getEndingOffset(), param.getStartingLine(), true ); //$NON-NLS-1$ } } symbol = template; } else { if( kind == ParamKind.CLASS || kind == ParamKind.TYPENAME ){ - symbol = pst.newSymbol( identifier.toCharArray() ); + symbol = pst.newSymbol( identifier ); provider.setType( ITypeInfo.t_templateParameter ); provider.setTemplateParameterType( ITypeInfo.t_typeName ); symbol.setTypeInfo( provider.completeConstruction() ); } else /*ParamKind.PARAMETER*/ { - symbol = cloneSimpleTypeSymbol( ((ASTParameterDeclaration)parameter).getNameArray(), parameter, null ); + symbol = cloneSimpleTypeSymbol( ((ASTParameterDeclaration)parameter).getNameCharArray(), parameter, null ); provider.setTemplateParameterType( symbol.getType() ); provider.setType( ITypeInfo.t_templateParameter ); provider.setTypeSymbol( symbol.getTypeSymbol() ); @@ -3143,22 +3142,21 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto */ public IASTTypedefDeclaration createTypedef( IASTScope scope, - String name, + char[] name, IASTAbstractDeclaration mapping, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, char[] fn) throws ASTSemanticException { - char[] nameArray = name.toCharArray(); IContainerSymbol containerSymbol = scopeToSymbol(scope); - ISymbol typeSymbol = cloneSimpleTypeSymbol( nameArray, mapping, null ); + ISymbol typeSymbol = cloneSimpleTypeSymbol( name, mapping, null ); if( typeSymbol == null ) - handleProblem( scope, IProblem.SEMANTICS_RELATED, nameArray, nameOffset, nameEndOffset, nameLine, true ); + handleProblem( scope, IProblem.SEMANTICS_RELATED, name, nameOffset, nameEndOffset, nameLine, true ); setPointerOperators( typeSymbol, mapping.getPointerOperators(), mapping.getArrayModifiers() ); if( typeSymbol.getType() != ITypeInfo.t_type ){ - ISymbol newSymbol = pst.newSymbol( nameArray, ITypeInfo.t_type); + ISymbol newSymbol = pst.newSymbol( name, ITypeInfo.t_type); newSymbol.getTypeInfo().setBit( true,ITypeInfo.isTypedef ); newSymbol.setTypeSymbol( typeSymbol ); typeSymbol = newSymbol; @@ -3186,7 +3184,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto } catch (ParserSymbolTableException e) { - handleProblem(e.createProblemID(), nameArray ); + handleProblem(e.createProblemID(), name ); } ASTTypedef d = new ASTTypedef( typeSymbol, mapping, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, references, filename ); attachSymbolExtension(typeSymbol, d, true ); @@ -3350,7 +3348,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto * java.lang.String, org.eclipse.cdt.core.parser.ITokenDuple, int, int, * int) */ - public IASTNamespaceAlias createNamespaceAlias(IASTScope scope, String identifier, ITokenDuple alias, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endOffset, int endingLine) throws ASTSemanticException + 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 ); IContainerSymbol startingSymbol = scopeToSymbol(scope); @@ -3361,7 +3359,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto if( namespaceSymbol.getType() != ITypeInfo.t_namespace ) handleProblem( IProblem.SEMANTIC_INVALID_OVERLOAD, alias.toCharArray(), startingOffset, endOffset, startingLine, true ); - ISymbol newSymbol = pst.newContainerSymbol( identifier.toCharArray(), ITypeInfo.t_namespace ); + ISymbol newSymbol = pst.newContainerSymbol( identifier, ITypeInfo.t_namespace ); newSymbol.setForwardSymbol( namespaceSymbol ); try @@ -3370,7 +3368,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto } catch (ParserSymbolTableException e) { - handleProblem( e.createProblemID(), identifier.toCharArray(), startingOffset, endOffset, startingLine, true ); + handleProblem( e.createProblemID(), identifier, startingOffset, endOffset, startingLine, true ); } ASTNamespaceAlias astAlias = new ASTNamespaceAlias( @@ -3453,17 +3451,17 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto return false; } - public IASTParameterDeclaration createParameterDeclaration(boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endingOffset, int endingLine, char[] fn) + public IASTParameterDeclaration createParameterDeclaration(boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, char[] parameterName, IASTInitializerClause initializerClause, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endingOffset, int endingLine, char[] fn) { setFilename(fn); - return new ASTParameterDeclaration( null, isConst, isVolatile, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOp, parameterName.toCharArray(), initializerClause, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, endingOffset, endingLine, filename ); + return new ASTParameterDeclaration( null, isConst, isVolatile, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOp, parameterName, initializerClause, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, endingOffset, endingLine, filename ); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTypeId(org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.Type, org.eclipse.cdt.core.parser.ITokenDuple, java.util.List, java.util.List) */ public IASTTypeId createTypeId(IASTScope scope, Type kind, boolean isConst, boolean isVolatile, boolean isShort, - boolean isLong, boolean isSigned, boolean isUnsigned, boolean isTypename, ITokenDuple name, List pointerOps, List arrayMods, String completeSignature) throws ASTSemanticException + boolean isLong, boolean isSigned, boolean isUnsigned, boolean isTypename, ITokenDuple name, List pointerOps, List arrayMods, char[] completeSignature) throws ASTSemanticException { if( kind != Type.CLASS_OR_TYPENAME ) { @@ -3472,7 +3470,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto return check; } ASTTypeId result = - new ASTTypeId( kind, name, pointerOps, arrayMods, completeSignature.toCharArray(), + new ASTTypeId( kind, name, pointerOps, arrayMods, completeSignature, isConst, isVolatile, isUnsigned, isSigned, isShort, isLong, isTypename ); result.setTypeSymbol( createSymbolForTypeId( scope, result ) ); if( kind != Type.CLASS_OR_TYPENAME ) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ExpressionFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ExpressionFactory.java index 9fa7e7420d6..46aa439a27d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ExpressionFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ExpressionFactory.java @@ -24,10 +24,10 @@ import org.eclipse.cdt.core.parser.ast.IASTExpression.Kind; */ public class ExpressionFactory { - public static ASTExpression createExpression(Kind kind, IASTExpression lhs, IASTExpression rhs, IASTExpression thirdExpression, IASTTypeId typeId, ITokenDuple idExpression, String literal, IASTNewExpressionDescriptor newDescriptor, List references ) + public static ASTExpression createExpression(Kind kind, IASTExpression lhs, IASTExpression rhs, IASTExpression thirdExpression, IASTTypeId typeId, ITokenDuple idExpression, char[] literal, IASTNewExpressionDescriptor newDescriptor, List references ) { - if( !literal.equals( "") && idExpression == null ) //$NON-NLS-1$ - return new ASTLiteralExpression( kind, references, literal.toCharArray() ); + if( literal.length != 0 && idExpression == null ) //$NON-NLS-1$ + return new ASTLiteralExpression( kind, references, literal ); if( idExpression != null && lhs == null ) return new ASTIdExpression( kind, references, idExpression ); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/gcc/GCCASTCompleteExtension.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/gcc/GCCASTCompleteExtension.java index 7c588d7f54f..99e3adcad33 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/gcc/GCCASTCompleteExtension.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/gcc/GCCASTCompleteExtension.java @@ -50,7 +50,7 @@ public class GCCASTCompleteExtension extends GCCASTExtension { return false; } - protected IASTExpression createExpression(IASTExpression.Kind kind, IASTExpression lhs, IASTExpression rhs, IASTExpression thirdExpression, IASTTypeId typeId, ITokenDuple idExpression, String literal, IASTNewExpressionDescriptor newDescriptor, List references) { + protected IASTExpression createExpression(IASTExpression.Kind kind, IASTExpression lhs, IASTExpression rhs, IASTExpression thirdExpression, IASTTypeId typeId, ITokenDuple idExpression, char[] literal, IASTNewExpressionDescriptor newDescriptor, List references) { if( lhs != null && rhs != null && (kind == IASTGCCExpression.Kind.RELATIONAL_MAX || kind == IASTGCCExpression.Kind.RELATIONAL_MIN ) ) @@ -113,7 +113,7 @@ public class GCCASTCompleteExtension extends GCCASTExtension { /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.extension.IASTFactoryExtension#createExpression(org.eclipse.cdt.core.parser.ast.IASTScope, org.eclipse.cdt.core.parser.ast.IASTExpression.Kind, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTTypeId, org.eclipse.cdt.core.parser.ITokenDuple, java.lang.String, org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor, java.util.List) */ - public IASTExpression createExpression(IASTScope scope, Kind kind, IASTExpression lhs, IASTExpression rhs, IASTExpression thirdExpression, IASTTypeId typeId, ITokenDuple idExpression, String literal, IASTNewExpressionDescriptor newDescriptor, List references) { + public IASTExpression createExpression(IASTScope scope, Kind kind, IASTExpression lhs, IASTExpression rhs, IASTExpression thirdExpression, IASTTypeId typeId, ITokenDuple idExpression, char[] literal, IASTNewExpressionDescriptor newDescriptor, List references) { if( canHandleExpressionKind( kind ) ) return createExpression( kind, lhs, rhs, thirdExpression, typeId, idExpression, literal, newDescriptor, references ); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/expression/ASTIdExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/expression/ASTIdExpression.java index 45105c88de1..de9c1a86ecb 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/expression/ASTIdExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/expression/ASTIdExpression.java @@ -19,14 +19,14 @@ import org.eclipse.cdt.core.parser.ast.IASTExpression; */ public class ASTIdExpression extends ASTExpression implements IASTExpression { - private final String idExpression; + private final char[] idExpression; /** * @param kind * @param idExpression */ - public ASTIdExpression(Kind kind, String idExpression) { + public ASTIdExpression(Kind kind, char[] idExpression) { super(kind); this.idExpression = idExpression; } @@ -36,7 +36,7 @@ public class ASTIdExpression extends ASTExpression implements IASTExpression { * @see org.eclipse.cdt.core.parser.ast.IASTExpression#getIdExpression() */ public String getIdExpression() { - return idExpression; + return String.valueOf(idExpression); } public String toString(){ diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/expression/ASTLiteralExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/expression/ASTLiteralExpression.java index 904e107f65e..9c7f34b50db 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/expression/ASTLiteralExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/expression/ASTLiteralExpression.java @@ -19,13 +19,13 @@ import org.eclipse.cdt.core.parser.ast.ASTUtil; */ public class ASTLiteralExpression extends ASTExpression { - private final String literal; + private final char[] literal; /** * @param kind * @param literal */ - public ASTLiteralExpression(Kind kind, String literal) { + public ASTLiteralExpression(Kind kind, char[] literal) { super( kind ); this.literal =literal; } @@ -33,7 +33,7 @@ public class ASTLiteralExpression extends ASTExpression { * @see org.eclipse.cdt.core.parser.ast.IASTExpression#getLiteralString() */ public String getLiteralString() { - return literal; + return String.valueOf( literal ); } public String toString(){ diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/expression/ASTUnaryIdExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/expression/ASTUnaryIdExpression.java index 3195615d7f4..2fed82fddbb 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/expression/ASTUnaryIdExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/expression/ASTUnaryIdExpression.java @@ -25,7 +25,7 @@ public class ASTUnaryIdExpression extends ASTIdExpression { * @param kind * @param idExpression */ - public ASTUnaryIdExpression(Kind kind, IASTExpression lhs, String idExpression) { + public ASTUnaryIdExpression(Kind kind, IASTExpression lhs, char[] idExpression) { super(kind, idExpression); this.lhs = lhs; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/expression/ExpressionFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/expression/ExpressionFactory.java index 259772173d1..300901e02b8 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/expression/ExpressionFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/expression/ExpressionFactory.java @@ -39,11 +39,11 @@ public class ExpressionFactory { * @param newDescriptor * @return */ - public static IASTExpression createExpression(Kind kind, IASTExpression lhs, IASTExpression rhs, IASTExpression thirdExpression, IASTTypeId typeId, String idExpression, String literal, IASTNewExpressionDescriptor newDescriptor) { - if( !literal.equals( EMPTY_STRING ) && idExpression.equals( EMPTY_STRING )) //$NON-NLS-1$ + public static IASTExpression createExpression(Kind kind, IASTExpression lhs, IASTExpression rhs, IASTExpression thirdExpression, IASTTypeId typeId, char[] idExpression, char[] literal, IASTNewExpressionDescriptor newDescriptor) { + if( literal.length != 0 && idExpression.length == 0 ) //$NON-NLS-1$ return new ASTLiteralExpression( kind, literal ); - if( !idExpression.equals( EMPTY_STRING ) && lhs == null ) + if( idExpression.length != 0 && lhs == null ) return new ASTIdExpression( kind, idExpression ); if( thirdExpression != null ) @@ -58,7 +58,7 @@ public class ExpressionFactory { if( lhs != null && typeId != null ) return new ASTUnaryTypeIdExpression( kind, lhs, typeId ); - if( lhs != null && !idExpression.equals( EMPTY_STRING ) ) + if( lhs != null && idExpression.length != 0 ) return new ASTUnaryIdExpression( kind, lhs, idExpression ); if( lhs != null ) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/expression/ExpressionParseASTFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/expression/ExpressionParseASTFactory.java index 8afa46ed0ae..7de56b216ee 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/expression/ExpressionParseASTFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/expression/ExpressionParseASTFactory.java @@ -92,7 +92,7 @@ public class ExpressionParseASTFactory extends BaseASTFactory implements IASTFac * org.eclipse.cdt.core.parser.IMacroDescriptor) */ public IASTMacro createMacro( - String name, + char[] name, int startingOffset, int startingLine, int nameOffset, @@ -112,8 +112,8 @@ public class ExpressionParseASTFactory extends BaseASTFactory implements IASTFac * java.lang.String, boolean, int, int, int, int, int, int, int) */ public IASTInclusion createInclusion( - String name, - String fileName, + char[] name, + char[] fileName, boolean local, int startingOffset, int startingLine, @@ -172,7 +172,7 @@ public class ExpressionParseASTFactory extends BaseASTFactory implements IASTFac */ public IASTASMDefinition createASMDefinition( IASTScope scope, - String assembly, + char[] assembly, int startingOffset, int startingLine, int endingOffset, @@ -189,7 +189,7 @@ public class ExpressionParseASTFactory extends BaseASTFactory implements IASTFac */ public IASTNamespaceDefinition createNamespaceDefinition( IASTScope scope, - String identifier, + char[] identifier, int startingOffset, int startingLine, int nameOffset, @@ -209,7 +209,7 @@ public class ExpressionParseASTFactory extends BaseASTFactory implements IASTFac */ public IASTNamespaceAlias createNamespaceAlias( IASTScope scope, - String identifier, + char[] identifier, ITokenDuple alias, int startingOffset, int startingLine, @@ -241,7 +241,7 @@ public class ExpressionParseASTFactory extends BaseASTFactory implements IASTFac */ public IASTLinkageSpecification createLinkageSpecification( IASTScope scope, - String spec, + char[] spec, int startingOffset, int startingLine, char[] fn) { // TODO Auto-generated method stub @@ -322,7 +322,7 @@ public class ExpressionParseASTFactory extends BaseASTFactory implements IASTFac */ public IASTEnumerationSpecifier createEnumerationSpecifier( IASTScope scope, - String name, + char[] name, int startingOffset, int startingLine, int nameOffset, @@ -342,7 +342,7 @@ public class ExpressionParseASTFactory extends BaseASTFactory implements IASTFac */ public IASTEnumerator addEnumerator( IASTEnumerationSpecifier enumeration, - String string, + char[] string, int startingOffset, int startingLine, int nameOffset, @@ -376,12 +376,12 @@ public class ExpressionParseASTFactory extends BaseASTFactory implements IASTFac IASTExpression thirdExpression, IASTTypeId typeId, ITokenDuple idExpression, - String literal, + char[] literal, IASTNewExpressionDescriptor newDescriptor) throws ASTSemanticException { if( extension.overrideCreateExpressionMethod() ) return extension.createExpression(scope, kind, lhs, rhs, thirdExpression, typeId, idExpression, literal, newDescriptor, null ); - return ExpressionFactory.createExpression( kind, lhs, rhs, thirdExpression, typeId, idExpression == null ? "" : idExpression.toString(), literal, newDescriptor ); //$NON-NLS-1$ + return ExpressionFactory.createExpression( kind, lhs, rhs, thirdExpression, typeId, idExpression == null ? EMPTY_STRING : idExpression.toCharArray(), literal, newDescriptor ); //$NON-NLS-1$ } /* @@ -687,7 +687,7 @@ public class ExpressionParseASTFactory extends BaseASTFactory implements IASTFac List arrayModifiers, List parameters, ASTPointerOperator pointerOp, - String parameterName, + char[] parameterName, IASTInitializerClause initializerClause, int startingOffset, int startingLine, @@ -726,7 +726,7 @@ public class ExpressionParseASTFactory extends BaseASTFactory implements IASTFac */ public IASTTemplateParameter createTemplateParameter( ParamKind kind, - String identifier, + char[] identifier, IASTTypeId defaultValue, IASTParameterDeclaration parameter, List parms, IASTCodeScope parameterScope, @@ -773,7 +773,7 @@ public class ExpressionParseASTFactory extends BaseASTFactory implements IASTFac */ public IASTTypedefDeclaration createTypedef( IASTScope scope, - String name, + char[] name, IASTAbstractDeclaration mapping, int startingOffset, int startingLine, @@ -849,7 +849,7 @@ public class ExpressionParseASTFactory extends BaseASTFactory implements IASTFac boolean isTypename, ITokenDuple name, List pointerOps, - List arrayMods, String completeSignature) + List arrayMods, char[] completeSignature) throws ASTSemanticException { // TODO Auto-generated method stub return null; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/expression/GCCASTExpressionExtension.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/expression/GCCASTExpressionExtension.java index bd5c56420d2..540d8d01f03 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/expression/GCCASTExpressionExtension.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/expression/GCCASTExpressionExtension.java @@ -59,8 +59,8 @@ public class GCCASTExpressionExtension extends GCCASTExtension { * @param newDescriptor * @return */ - private static IASTExpression createExpression(IASTExpression.Kind kind, IASTExpression lhs, IASTExpression rhs, IASTExpression thirdExpression, IASTTypeId typeId, String idExpression, String literal, IASTNewExpressionDescriptor newDescriptor) { - if( !idExpression.equals( String.valueOf(EMPTY_STRING) ) && literal.equals( String.valueOf(EMPTY_STRING) )) + private static IASTExpression createExpression(IASTExpression.Kind kind, IASTExpression lhs, IASTExpression rhs, IASTExpression thirdExpression, IASTTypeId typeId, char[] idExpression, char[] literal, IASTNewExpressionDescriptor newDescriptor) { + if( idExpression.length != 0 && literal.length == 0 ) return new ASTIdExpression( kind, idExpression ) { public long evaluateExpression() throws ASTExpressionEvaluationException { @@ -131,7 +131,7 @@ public class GCCASTExpressionExtension extends GCCASTExtension { /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.extension.IASTFactoryExtension#createExpression(org.eclipse.cdt.core.parser.ast.IASTScope, org.eclipse.cdt.core.parser.ast.IASTExpression.Kind, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTTypeId, org.eclipse.cdt.core.parser.ITokenDuple, java.lang.String, org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor, java.util.List) */ - public IASTExpression createExpression(IASTScope scope, Kind kind, IASTExpression lhs, IASTExpression rhs, IASTExpression thirdExpression, IASTTypeId typeId, ITokenDuple idExpression, String literal, IASTNewExpressionDescriptor newDescriptor, List references) { - return createExpression( kind, lhs, rhs, thirdExpression, typeId, (idExpression == null ) ? String.valueOf(EMPTY_STRING) : idExpression.toString(), literal, newDescriptor ); + public IASTExpression createExpression(IASTScope scope, Kind kind, IASTExpression lhs, IASTExpression rhs, IASTExpression thirdExpression, IASTTypeId typeId, ITokenDuple idExpression, char[] literal, IASTNewExpressionDescriptor newDescriptor, List references) { + return createExpression( kind, lhs, rhs, thirdExpression, typeId, (idExpression == null ) ? EMPTY_STRING : idExpression.toCharArray(), literal, newDescriptor ); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTASMDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTASMDefinition.java index 598ca7e2534..3c6d370d856 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTASMDefinition.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTASMDefinition.java @@ -23,7 +23,7 @@ public class ASTASMDefinition extends ASTDeclaration implements IASTASMDefinition { - private final String assembly; + private final char[] assembly; private final char [] fn; /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getFilename() @@ -36,7 +36,7 @@ public class ASTASMDefinition * @param scope * @param filename */ - public ASTASMDefinition(IASTScope scope, String assembly, char[] filename) { + public ASTASMDefinition(IASTScope scope, char[] assembly, char[] filename) { super(scope); this.assembly = assembly; fn = filename; @@ -46,7 +46,7 @@ public class ASTASMDefinition * @see org.eclipse.cdt.core.parser.ast.IASTASMDefinition#getBody() */ public String getBody() { - return assembly; + return String.valueOf(assembly); } /* (non-Javadoc) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTClassSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTClassSpecifier.java index 299ae9aa090..f6bd7d74d8a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTClassSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTClassSpecifier.java @@ -29,7 +29,7 @@ public class ASTClassSpecifier extends ASTScopedTypeSpecifier implements IASTQCl public ASTClassSpecifier( IASTScope scope, - String name, + char[] name, ASTClassKind kind, ClassNameType type, int startingOffset, @@ -48,7 +48,7 @@ public class ASTClassSpecifier extends ASTScopedTypeSpecifier implements IASTQCl fn = filename; } - private final String name; + private final char[] name; private List declarations = new ArrayList(); private List baseClauses = new ArrayList(); private List friends = new ArrayList(); @@ -103,7 +103,7 @@ public class ASTClassSpecifier extends ASTScopedTypeSpecifier implements IASTQCl */ public String getName() { - return name; + return String.valueOf(name); } /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.ast.quick.IASTQScope#addDeclaration(org.eclipse.cdt.core.parser.ast.IASTDeclaration) @@ -257,4 +257,11 @@ public class ASTClassSpecifier extends ASTScopedTypeSpecifier implements IASTQCl nameEndOffset = offset; nameLineNumber = lineNumber; } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameCharArray() + */ + public char[] getNameCharArray() { + return name; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTElaboratedTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTElaboratedTypeSpecifier.java index 4f6d96b1592..7a248e1c3b6 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTElaboratedTypeSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTElaboratedTypeSpecifier.java @@ -24,7 +24,7 @@ import org.eclipse.cdt.internal.core.parser.ast.ASTQualifiedNamedElement; */ public class ASTElaboratedTypeSpecifier extends ASTNode implements IASTElaboratedTypeSpecifier { - private final String typeName; + private final char[] typeName; private final ASTClassKind classKind; private final ASTQualifiedNamedElement qualifiedName; private final char [] fn; @@ -42,7 +42,7 @@ public class ASTElaboratedTypeSpecifier extends ASTNode implements IASTElaborate * @param endOffset * @param filename */ - public ASTElaboratedTypeSpecifier(IASTScope scope, ASTClassKind elaboratedClassKind, String typeName, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endOffset, int endingLine, char[] filename) + public ASTElaboratedTypeSpecifier(IASTScope scope, ASTClassKind elaboratedClassKind, char[] typeName, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endOffset, int endingLine, char[] filename) { classKind = elaboratedClassKind; this.typeName = typeName; @@ -50,7 +50,7 @@ public class ASTElaboratedTypeSpecifier extends ASTNode implements IASTElaborate setNameOffset( nameOffset ); setNameEndOffsetAndLineNumber( nameEndOffset, nameLine ); setEndingOffsetAndLineNumber( endOffset, endingLine ); - qualifiedName = new ASTQualifiedNamedElement( scope, typeName.toCharArray() ); + qualifiedName = new ASTQualifiedNamedElement( scope, typeName ); fn = filename; } /* (non-Javadoc) @@ -58,7 +58,7 @@ public class ASTElaboratedTypeSpecifier extends ASTNode implements IASTElaborate */ public String getName() { - return typeName; + return String.valueOf(typeName); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier#getClassKind() @@ -190,4 +190,11 @@ public class ASTElaboratedTypeSpecifier extends ASTNode implements IASTElaborate nameEndOffset = offset; nameLineNumber = lineNumber; } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameCharArray() + */ + public char[] getNameCharArray() { + return typeName; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTEnumerationSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTEnumerationSpecifier.java index 67d5df8fbeb..56386e78573 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTEnumerationSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTEnumerationSpecifier.java @@ -28,7 +28,7 @@ import org.eclipse.cdt.core.parser.ast.IReferenceManager; public class ASTEnumerationSpecifier extends ASTScopedTypeSpecifier implements IASTEnumerationSpecifier, IASTOffsetableNamedElement { - private final String name; + private final char[] name; private final char [] fn; /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getFilename() @@ -43,7 +43,7 @@ public class ASTEnumerationSpecifier extends ASTScopedTypeSpecifier * @param startingOffset * @param filename */ - public ASTEnumerationSpecifier(IASTScope scope, String name, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, char[] filename ) + public ASTEnumerationSpecifier(IASTScope scope, char[] name, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, char[] filename ) { super( scope, name ); this.name = name; @@ -57,7 +57,7 @@ public class ASTEnumerationSpecifier extends ASTScopedTypeSpecifier */ public String getName() { - return name; + return String.valueOf(name); } private List enumerators = new ArrayList(); /* (non-Javadoc) @@ -187,4 +187,12 @@ public class ASTEnumerationSpecifier extends ASTScopedTypeSpecifier nameEndOffset = offset; nameLineNumber = lineNumber; } + + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameCharArray() + */ + public char[] getNameCharArray() { + return name; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTEnumerator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTEnumerator.java index b5d6a57ec54..0bbe7833d98 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTEnumerator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTEnumerator.java @@ -26,7 +26,7 @@ public class ASTEnumerator extends ASTNode implements IASTEnumerator, IASTOffsetableNamedElement { private final IASTExpression initialValue; - private final String name; + private final char[] name; private final IASTEnumerationSpecifier enumeration; private final char [] fn; /* (non-Javadoc) @@ -44,7 +44,7 @@ public class ASTEnumerator extends ASTNode * @param endingOffset * @param filename */ - public ASTEnumerator(IASTEnumerationSpecifier enumeration, String string, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endingOffset, int endLine, IASTExpression initialValue, char[] filename) + public ASTEnumerator(IASTEnumerationSpecifier enumeration, char[] string, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endingOffset, int endLine, IASTExpression initialValue, char[] filename) { this.enumeration = enumeration; name = string; @@ -60,7 +60,7 @@ public class ASTEnumerator extends ASTNode */ public String getName() { - return name; + return String.valueOf(name); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTEnumerator#getOwnerEnumerationSpecifier() @@ -182,4 +182,12 @@ public class ASTEnumerator extends ASTNode { nameEndOffset = offset; } + + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameCharArray() + */ + public char[] getNameCharArray() { + return name; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTField.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTField.java index 2326bc53a07..087bccb68a0 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTField.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTField.java @@ -39,7 +39,7 @@ public class ASTField extends ASTVariable implements IASTField * @param isRegister * @param isStatic */ - public ASTField(IASTScope scope, String name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int startLine, int nameOffset, int nameEndOffset, int nameLine, IASTExpression constructorExpression, ASTAccessVisibility visibility, char [] filename) + public ASTField(IASTScope scope, char[] name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int startLine, int nameOffset, int nameEndOffset, int nameLine, IASTExpression constructorExpression, ASTAccessVisibility visibility, char [] filename) { super( scope, diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTFunction.java index f0a9368482c..3c01d244a9b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTFunction.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTFunction.java @@ -35,7 +35,7 @@ public class ASTFunction extends ASTDeclaration implements IASTFunction * @param scope * @param filename */ - public ASTFunction(IASTScope scope, String name, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, boolean isInline, + public ASTFunction(IASTScope scope, char[] name, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, boolean isInline, boolean isFriend, boolean isStatic, int startOffset, int startLine, int nameOffset, int nameEndOffset, IASTTemplate ownerTemplate, boolean hasFunctionTryBlock, boolean hasVarArgs, int nameLine, char[] filename ) { super(ownerTemplate != null ? null : scope ); @@ -51,7 +51,7 @@ public class ASTFunction extends ASTDeclaration implements IASTFunction ownerTemplate.setOwnedDeclaration( this ); setStartingOffsetAndLineNumber( startOffset, startLine ); setNameOffset( nameOffset ); - qualifiedName = new ASTQualifiedNamedElement( scope, name.toCharArray() ); + qualifiedName = new ASTQualifiedNamedElement( scope, name ); setNameEndOffsetAndLineNumber(nameEndOffset, nameLine); this.hasFunctionTryBlock = hasFunctionTryBlock; this.varArgs = hasVarArgs; @@ -64,7 +64,7 @@ public class ASTFunction extends ASTDeclaration implements IASTFunction private final IASTTemplate ownerTemplateDeclaration; private List declarations = new ArrayList(); private final IASTExceptionSpecification exceptionSpec; - private final String name; + private final char[] name; private final List parms; private final IASTAbstractDeclaration returnType; private final boolean isInline, isFriend, isStatic; @@ -103,7 +103,7 @@ public class ASTFunction extends ASTDeclaration implements IASTFunction */ public String getName() { - return name; + return String.valueOf(name); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTFunction#getReturnType() @@ -334,4 +334,12 @@ public class ASTFunction extends ASTDeclaration implements IASTFunction nameEndOffset = offset; nameLineNumber = lineNumber; } + + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameCharArray() + */ + public char[] getNameCharArray() { + return name; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTLinkageSpecification.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTLinkageSpecification.java index d682f9c0a8c..a27bf76bd2b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTLinkageSpecification.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTLinkageSpecification.java @@ -28,7 +28,7 @@ public class ASTLinkageSpecification extends ASTDeclaration implements IASTDeclaration, IASTLinkageSpecification, IASTQScope { - private final String linkage; + private final char[] linkage; private final char [] fn; /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getFilename() @@ -37,7 +37,7 @@ public class ASTLinkageSpecification return fn; } - public ASTLinkageSpecification( IASTScope scope, String linkage, int startingOffset, int startingLine, char[] filename ) + public ASTLinkageSpecification( IASTScope scope, char[] linkage, int startingOffset, int startingLine, char[] filename ) { super( scope ); this.linkage = linkage; @@ -49,7 +49,7 @@ public class ASTLinkageSpecification * @see org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification#getLinkageString() */ public String getLinkageString() { - return linkage; + return String.valueOf(linkage); } private List declarations = new ArrayList(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTMethod.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTMethod.java index f945f11893f..69174778c4c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTMethod.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTMethod.java @@ -56,7 +56,7 @@ public class ASTMethod extends ASTFunction implements IASTMethod */ public ASTMethod( IASTScope scope, - String name, + char[] name, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, @@ -98,7 +98,7 @@ public class ASTMethod extends ASTFunction implements IASTMethod this.isVolatile = isVolatile; this.visibility = visibility; this.constructorChainElements = constructorChainElements; - qualifiedName = new ASTQualifiedNamedElement( scope, name.toCharArray() ); + qualifiedName = new ASTQualifiedNamedElement( scope, name ); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTMethod#isVirtual() diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNamespaceAlias.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNamespaceAlias.java index c98231ae2f9..f98ecd8f7d3 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNamespaceAlias.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNamespaceAlias.java @@ -24,8 +24,8 @@ import org.eclipse.cdt.core.parser.ast.IReferenceManager; public class ASTNamespaceAlias extends ASTDeclaration implements IASTNamespaceAlias { - private final String alias; - private final String identifier; + private final char[] alias; + private final char[] identifier; private final char [] fn; /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getFilename() @@ -43,7 +43,7 @@ public class ASTNamespaceAlias extends ASTDeclaration implements IASTNamespaceAl * @param endOffset * @param filename */ - public ASTNamespaceAlias(IASTScope scope, String identifier, String string, int startingOffset, int nameOffset, int nameEndOffset, int endOffset, int startingLine, int nameLine, int endingLine, char[] filename) + public ASTNamespaceAlias(IASTScope scope, char[] identifier, char[] string, int startingOffset, int nameOffset, int nameEndOffset, int endOffset, int startingLine, int nameLine, int endingLine, char[] filename) { super( scope ); setStartingOffsetAndLineNumber(startingOffset, startingLine); @@ -80,7 +80,7 @@ public class ASTNamespaceAlias extends ASTDeclaration implements IASTNamespaceAl */ public String getAlias() { - return alias; + return String.valueOf(alias); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTNamespaceAlias#getNamespace() @@ -94,7 +94,7 @@ public class ASTNamespaceAlias extends ASTDeclaration implements IASTNamespaceAl */ public String getName() { - return identifier; + return String.valueOf(identifier); } private int startingLineNumber, startingOffset, endingLineNumber, endingOffset, nameStartOffset, nameEndOffset, nameLineNumber; @@ -179,4 +179,11 @@ public class ASTNamespaceAlias extends ASTDeclaration implements IASTNamespaceAl nameEndOffset = offset; nameLineNumber = lineNumber; } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameCharArray() + */ + public char[] getNameCharArray() { + return identifier; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNamespaceDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNamespaceDefinition.java index 53670992d62..6b387710b99 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNamespaceDefinition.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNamespaceDefinition.java @@ -27,7 +27,7 @@ import org.eclipse.cdt.internal.core.parser.ast.ASTQualifiedNamedElement; */ public class ASTNamespaceDefinition extends ASTDeclaration implements IASTNamespaceDefinition, IASTQScope { - private final String name; + private final char[] name; private final ASTQualifiedNamedElement qualifiedNameElement; private final char [] fn; /* (non-Javadoc) @@ -37,10 +37,10 @@ public class ASTNamespaceDefinition extends ASTDeclaration implements IASTNamesp return fn; } - public ASTNamespaceDefinition( IASTScope scope, String name, int startOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, char[] filename ) + public ASTNamespaceDefinition( IASTScope scope, char[] name, int startOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, char[] filename ) { super( scope ); - qualifiedNameElement = new ASTQualifiedNamedElement( scope, name.toCharArray() ); + qualifiedNameElement = new ASTQualifiedNamedElement( scope, name ); this.name = name; setStartingOffsetAndLineNumber(startOffset, startingLine); setNameOffset(nameOffset); @@ -51,7 +51,7 @@ public class ASTNamespaceDefinition extends ASTDeclaration implements IASTNamesp * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getName() */ public String getName() { - return name; + return String.valueOf(name); } private List declarations = new ArrayList(); @@ -191,4 +191,11 @@ public class ASTNamespaceDefinition extends ASTDeclaration implements IASTNamesp nameEndOffset = offset; nameLineNumber = lineNumber; } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameCharArray() + */ + public char[] getNameCharArray() { + return name; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTParameterDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTParameterDeclaration.java index 9185a30f448..4fd7d19917a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTParameterDeclaration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTParameterDeclaration.java @@ -26,7 +26,7 @@ import org.eclipse.cdt.internal.core.parser.ast.ASTAbstractDeclaration; */ public class ASTParameterDeclaration extends ASTAbstractDeclaration implements IASTParameterDeclaration { - private final String parameterName; + private final char[] parameterName; private final IASTInitializerClause initializerClause; private final char [] fn; /* (non-Javadoc) @@ -45,7 +45,7 @@ public class ASTParameterDeclaration extends ASTAbstractDeclaration implements I * @param initializerClause * @param filename */ - public ASTParameterDeclaration(boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endingOffset, int endingLine, char[] filename ) + public ASTParameterDeclaration(boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, char[] parameterName, IASTInitializerClause initializerClause, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endingOffset, int endingLine, char[] filename ) { super( isConst, isVolatile, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOp ); this.parameterName = parameterName; @@ -61,7 +61,7 @@ public class ASTParameterDeclaration extends ASTAbstractDeclaration implements I */ public String getName() { - return parameterName; + return String.valueOf(parameterName); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration#getDefaultValue() @@ -160,4 +160,11 @@ public class ASTParameterDeclaration extends ASTAbstractDeclaration implements I nameEndOffset = offset; nameLineNumber = lineNumber; } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameCharArray() + */ + public char[] getNameCharArray() { + return parameterName; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTScopedTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTScopedTypeSpecifier.java index 80a98be42fa..1df9e295dbd 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTScopedTypeSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTScopedTypeSpecifier.java @@ -24,9 +24,9 @@ public class ASTScopedTypeSpecifier extends ASTQualifiedNamedElement implements { private final IASTScope scope; - public ASTScopedTypeSpecifier( IASTScope scope, String name ) + public ASTScopedTypeSpecifier( IASTScope scope, char[] name ) { - super( scope, name.toCharArray() ); + super( scope, name ); this.scope = scope; } /* (non-Javadoc) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateParameter.java index f2a40f1a7cd..ec46e054b0f 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateParameter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateParameter.java @@ -31,8 +31,8 @@ public class ASTTemplateParameter implements IASTTemplateParameter, IASTOffsetab private final List templateParms; private final IASTParameterDeclaration parameter; private final ParamKind kind; - private final String identifier; - private final String defaultValue; + private final char[] identifier; + private final char[] defaultValue; private final char [] fn; /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getFilename() @@ -48,7 +48,7 @@ public class ASTTemplateParameter implements IASTTemplateParameter, IASTOffsetab * @param parameter * @param filename */ - public ASTTemplateParameter(ParamKind kind, String identifier, String defaultValue, IASTParameterDeclaration parameter, List templateParms, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endingOffset, int endingLine, char[] filename ) + public ASTTemplateParameter(ParamKind kind, char[] identifier, char[] defaultValue, IASTParameterDeclaration parameter, List templateParms, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endingOffset, int endingLine, char[] filename ) { this.kind = kind; this.identifier = identifier; @@ -74,14 +74,14 @@ public class ASTTemplateParameter implements IASTTemplateParameter, IASTOffsetab */ public String getIdentifier() { - return identifier; + return String.valueOf(identifier); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTTemplateParameter#getDefaultValueIdExpression() */ public String getDefaultValueIdExpression() { - return defaultValue; + return String.valueOf(defaultValue); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTTemplateParameterList#getTemplateParameters() @@ -125,7 +125,7 @@ public class ASTTemplateParameter implements IASTTemplateParameter, IASTOffsetab * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getName() */ public String getName() { - return identifier; + return String.valueOf(identifier); } private int startingLineNumber, startingOffset, endingLineNumber, endingOffset, nameStartOffset, nameEndOffset, nameLineNumber; @@ -210,4 +210,11 @@ public class ASTTemplateParameter implements IASTTemplateParameter, IASTOffsetab nameEndOffset = offset; nameLineNumber = lineNumber; } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameCharArray() + */ + public char[] getNameCharArray() { + return identifier; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTypeId.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTypeId.java index 916a49d3ccd..36f84d1ee55 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTypeId.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTypeId.java @@ -34,18 +34,18 @@ public class ASTTypeId implements IASTTypeId private final boolean isLong; private final boolean isConst; private final Type kind; - private final String name; + private final char[] name; private final List pointerOps; private final List arrayMods; - private final String completeSignature; + private final char[] completeSignature; /** * @param kind * @param string * @param pointerOps * @param arrayMods */ - public ASTTypeId(Type kind, String string, List pointerOps, List arrayMods, boolean isConst, boolean isVolatile, - boolean isUnsigned, boolean isSigned, boolean isShort, boolean isLong, boolean isTypeName, String completeSignature) + public ASTTypeId(Type kind, char[] string, List pointerOps, List arrayMods, boolean isConst, boolean isVolatile, + boolean isUnsigned, boolean isSigned, boolean isShort, boolean isLong, boolean isTypeName, char[] completeSignature) { this.kind = kind; this.name = string; @@ -72,7 +72,7 @@ public class ASTTypeId implements IASTTypeId */ public String getTypeOrClassName() { - return name; + return String.valueOf(name); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTTypeId#getPointerOperators() @@ -93,7 +93,7 @@ public class ASTTypeId implements IASTTypeId */ public String getFullSignature() { - return completeSignature; + return String.valueOf(completeSignature); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTTypeId#createTypeSymbol(org.eclipse.cdt.core.parser.ast.IASTFactory) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTypedefDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTypedefDeclaration.java index 27a00a30945..626536f0098 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTypedefDeclaration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTypedefDeclaration.java @@ -26,7 +26,7 @@ import org.eclipse.cdt.internal.core.parser.ast.ASTQualifiedNamedElement; public class ASTTypedefDeclaration extends ASTDeclaration implements IASTTypedefDeclaration { protected static final ASTNotImplementedException NOT_IMPLEMENTED = new ASTNotImplementedException(); - private final String name; + private final char[] name; private final IASTAbstractDeclaration mapping; private final ASTQualifiedNamedElement qualifiedName; private final char [] fn; @@ -43,7 +43,7 @@ public class ASTTypedefDeclaration extends ASTDeclaration implements IASTTypedef * @param mapping * @param filename */ - public ASTTypedefDeclaration(IASTScope scope, String name, IASTAbstractDeclaration mapping, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, char[] filename ) + public ASTTypedefDeclaration(IASTScope scope, char[] name, IASTAbstractDeclaration mapping, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, char[] filename ) { super( scope ); this.name = name; @@ -51,7 +51,7 @@ public class ASTTypedefDeclaration extends ASTDeclaration implements IASTTypedef setStartingOffsetAndLineNumber(startingOffset, startingLine); setNameOffset(nameOffset); setNameEndOffsetAndLineNumber(nameEndOffset, nameLine); - qualifiedName = new ASTQualifiedNamedElement( scope, name.toCharArray() ); + qualifiedName = new ASTQualifiedNamedElement( scope, name ); fn = filename; } /* (non-Javadoc) @@ -59,7 +59,7 @@ public class ASTTypedefDeclaration extends ASTDeclaration implements IASTTypedef */ public String getName() { - return name; + return String.valueOf(name); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTTypedef#getAbstractDeclarator() @@ -191,4 +191,11 @@ public class ASTTypedefDeclaration extends ASTDeclaration implements IASTTypedef nameEndOffset = offset; nameLineNumber = lineNumber; } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameCharArray() + */ + public char[] getNameCharArray() { + return name; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTVariable.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTVariable.java index f6cdb1b922e..07135a3bc45 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTVariable.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTVariable.java @@ -34,7 +34,7 @@ public class ASTVariable extends ASTDeclaration implements IASTVariable private final boolean isExtern; private final boolean isRegister; private final boolean isStatic; - private final String name; + private final char[] name; private final ASTQualifiedNamedElement qualifiedName; private final char [] fn; /* (non-Javadoc) @@ -48,7 +48,7 @@ public class ASTVariable extends ASTDeclaration implements IASTVariable * @param scope * @param filename */ - public ASTVariable(IASTScope scope, String name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, + public ASTVariable(IASTScope scope, char[] name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int startLine, int nameOffset, int nameEndOffset, int nameLine, IASTExpression constructorExpression, char[] filename ) { super(scope); @@ -62,7 +62,7 @@ public class ASTVariable extends ASTDeclaration implements IASTVariable this.isStatic = isStatic; this.name = name; this.constructorExpression = constructorExpression; - qualifiedName = new ASTQualifiedNamedElement( scope, name.toCharArray() ); + qualifiedName = new ASTQualifiedNamedElement( scope, name ); setStartingOffsetAndLineNumber(startingOffset, startLine); setNameOffset(nameOffset); setNameEndOffsetAndLineNumber( nameEndOffset, nameLine ); @@ -117,7 +117,7 @@ public class ASTVariable extends ASTDeclaration implements IASTVariable */ public String getName() { - return name; + return String.valueOf(name); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTVariable#getInitializerClause() @@ -263,5 +263,12 @@ public class ASTVariable extends ASTDeclaration implements IASTVariable nameEndOffset = offset; nameLineNumber = lineNumber; } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameCharArray() + */ + public char[] getNameCharArray() { + return name; + } } 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 24a6263da1b..e2228a0c487 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 @@ -87,7 +87,7 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.ast.IASTFactory#createASMDefinition(org.eclipse.cdt.internal.core.parser.ast.IASTScope, java.lang.String, int, int) */ - public IASTASMDefinition createASMDefinition(IASTScope scope, String assembly, int startingOffset, int startingLine, int endingOffset, int endingLine, char[] fn) { + public IASTASMDefinition createASMDefinition(IASTScope scope, char[] assembly, int startingOffset, int startingLine, int endingOffset, int endingLine, char[] fn) { IASTASMDefinition definition = new ASTASMDefinition( scope, assembly, fn ); definition.setStartingOffsetAndLineNumber( startingOffset, startingLine ); definition.setEndingOffsetAndLineNumber( endingOffset, endingLine ); @@ -97,7 +97,7 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.ast.IASTFactory#createNamespaceDefinition(int, java.lang.String, int) */ - public IASTNamespaceDefinition createNamespaceDefinition(IASTScope scope, String identifier, int first, int startingLine, int nameOffset, int nameEndOffset, int nameLineNumber, char[] fn) { + public IASTNamespaceDefinition createNamespaceDefinition(IASTScope scope, char[] identifier, int first, int startingLine, int nameOffset, int nameEndOffset, int nameLineNumber, char[] fn) { IASTNamespaceDefinition definition = new ASTNamespaceDefinition( scope, identifier, first, startingLine, nameOffset, nameEndOffset, nameLineNumber, fn ); return definition; } @@ -112,7 +112,7 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser.ast.IASTFactory#createLinkageSpecification(java.lang.String) */ - public IASTLinkageSpecification createLinkageSpecification(IASTScope scope, String spec, int startingOffset, int startingLine, char[] fn) { + public IASTLinkageSpecification createLinkageSpecification(IASTScope scope, char[] spec, int startingOffset, int startingLine, char[] fn) { return new ASTLinkageSpecification( scope, spec, startingOffset, startingLine, fn ); } @@ -127,7 +127,7 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createClassSpecifier(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, org.eclipse.cdt.core.parser.ast.ClassKind, org.eclipse.cdt.core.parser.ast.ClassNameType, org.eclipse.cdt.core.parser.ast.AccessVisibility, org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration) */ public IASTClassSpecifier createClassSpecifier(IASTScope scope, ITokenDuple name, ASTClassKind kind, ClassNameType type, ASTAccessVisibility access, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, char[] fn ) { - return new ASTClassSpecifier( scope, name == null ? "" : name.toString() , kind, type, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, access, fn ); //$NON-NLS-1$ + return new ASTClassSpecifier( scope, name == null ? EMPTY_STRING : name.toCharArray() , kind, type, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, access, fn ); //$NON-NLS-1$ } /* (non-Javadoc) @@ -141,7 +141,7 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createEnumerationSpecifier(java.lang.String, int) */ - public IASTEnumerationSpecifier createEnumerationSpecifier(IASTScope scope, String name, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, char[] fn) + public IASTEnumerationSpecifier createEnumerationSpecifier(IASTScope scope, char[] name, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, char[] fn) { return new ASTEnumerationSpecifier( scope, name, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, fn ); } @@ -149,7 +149,7 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTFactory#addEnumerator(org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier, java.lang.String, int, int) */ - public IASTEnumerator addEnumerator(IASTEnumerationSpecifier enumeration, String string, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endingOffset, int endLine, IASTExpression initialValue, char[] fn) + public IASTEnumerator addEnumerator(IASTEnumerationSpecifier enumeration, char[] string, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endingOffset, int endLine, IASTExpression initialValue, char[] fn) { IASTEnumerator enumerator = new ASTEnumerator( enumeration, string, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, endingOffset, endLine, initialValue, fn ); ((ASTEnumerationSpecifier)enumeration).addEnumerator( enumerator ); @@ -159,8 +159,8 @@ 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, String literal, IASTNewExpressionDescriptor newDescriptor) { - return temporarilyDisableNodeConstruction ? ExpressionFactory.createExpression( kind, lhs, rhs, thirdExpression, typeId, idExpression == null ? "" : idExpression.toString(), literal, newDescriptor ) : null; //$NON-NLS-1$ + public IASTExpression createExpression(IASTScope scope, Kind kind, IASTExpression lhs, IASTExpression rhs, IASTExpression thirdExpression, IASTTypeId typeId, ITokenDuple idExpression, char[] literal, IASTNewExpressionDescriptor newDescriptor) { + return temporarilyDisableNodeConstruction ? ExpressionFactory.createExpression( kind, lhs, rhs, thirdExpression, typeId, idExpression == null ? EMPTY_STRING : idExpression.toCharArray(), literal, newDescriptor ) : null; //$NON-NLS-1$ } /* (non-Javadoc) @@ -200,7 +200,7 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory */ public IASTFunction createFunction(IASTScope scope, ITokenDuple name, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, boolean isInline, boolean isFriend, boolean isStatic, int startOffset, int startLine, int nameOffset, int nameEndOffset, int nameLine, IASTTemplate ownerTemplate, boolean isConst, boolean isVolatile, boolean isVirtual, boolean isExplicit, boolean isPureVirtual, List constructorChain, boolean isFunctionDefinition, boolean hasFunctionTryBlock, boolean hasVariableArguments ) { - ASTFunction function = new ASTFunction(scope, name.toString(), parameters, returnType, exception, isInline, isFriend, isStatic, startOffset, startLine, nameOffset, nameEndOffset, ownerTemplate, hasFunctionTryBlock, hasVariableArguments, nameLine, name.getFilename() ); + ASTFunction function = new ASTFunction(scope, name.toCharArray(), parameters, returnType, exception, isInline, isFriend, isStatic, startOffset, startLine, nameOffset, nameEndOffset, ownerTemplate, hasFunctionTryBlock, hasVariableArguments, nameLine, name.getFilename() ); if( isFriend && scope instanceof IASTQClassSpecifier ){ ((IASTQClassSpecifier)scope).addFriendDeclaration( function ); } @@ -212,7 +212,7 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory */ public IASTMethod createMethod(IASTScope scope, ITokenDuple name, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, boolean isInline, boolean isFriend, boolean isStatic, int startOffset, int startLine, int nameOffset, int nameEndOffset, int nameLine, IASTTemplate ownerTemplate, boolean isConst, boolean isVolatile, boolean isVirtual, boolean isExplicit, boolean isPureVirtual, ASTAccessVisibility visibility, List constructorChain, boolean isFunctionDefinition, boolean hasFunctionTryBlock, boolean hasVariableArguments ) { - ASTMethod method = new ASTMethod(scope, name.toString(), parameters, returnType, exception, isInline, isFriend, isStatic, startOffset, startLine, nameOffset, nameEndOffset, nameLine, ownerTemplate, isConst, isVolatile, false, false, isVirtual, isExplicit, isPureVirtual, visibility, constructorChain, hasFunctionTryBlock, hasVariableArguments, name.getFilename()); + ASTMethod method = new ASTMethod(scope, name.toCharArray(), parameters, returnType, exception, isInline, isFriend, isStatic, startOffset, startLine, nameOffset, nameEndOffset, nameLine, ownerTemplate, isConst, isVolatile, false, false, isVirtual, isExplicit, isPureVirtual, visibility, constructorChain, hasFunctionTryBlock, hasVariableArguments, name.getFilename()); if( isFriend && scope instanceof IASTQClassSpecifier ){ ((IASTQClassSpecifier)scope).addFriendDeclaration( method ); } @@ -224,7 +224,7 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory */ public IASTVariable createVariable(IASTScope scope, ITokenDuple name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, IASTExpression constructorExpression, char[] fn) { - return new ASTVariable(scope, ( name != null ? name.toString() : "" ), isAuto, initializerClause, bitfieldExpression, abstractDeclaration, isMutable, isExtern, isRegister, isStatic, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, constructorExpression, fn); //$NON-NLS-1$ + return new ASTVariable(scope, ( name != null ? name.toCharArray() : EMPTY_STRING ), isAuto, initializerClause, bitfieldExpression, abstractDeclaration, isMutable, isExtern, isRegister, isStatic, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, constructorExpression, fn); //$NON-NLS-1$ } /* (non-Javadoc) @@ -232,7 +232,7 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory */ public IASTField createField(IASTScope scope, ITokenDuple name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, IASTExpression constructorExpression, ASTAccessVisibility visibility, char[] fn) { - return new ASTField(scope, ( name != null ? name.toString() : "" ), isAuto, initializerClause, bitfieldExpression, abstractDeclaration, isMutable, isExtern, isRegister, isStatic, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, constructorExpression, visibility, fn); //$NON-NLS-1$ + return new ASTField(scope, ( name != null ? name.toCharArray() : EMPTY_STRING ), isAuto, initializerClause, bitfieldExpression, abstractDeclaration, isMutable, isExtern, isRegister, isStatic, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, constructorExpression, visibility, fn); //$NON-NLS-1$ } /* (non-Javadoc) @@ -246,9 +246,9 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTemplateParameter(org.eclipse.cdt.core.parser.ast.IASTTemplateParameter.ParameterKind, org.eclipse.cdt.core.parser.IToken, java.lang.String, org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration) */ - public IASTTemplateParameter createTemplateParameter(IASTTemplateParameter.ParamKind kind, String identifier, IASTTypeId defaultValue, IASTParameterDeclaration parameter, List parms, IASTCodeScope parameterScope, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endingOffset, int endingLine, char[] fn) + public IASTTemplateParameter createTemplateParameter(IASTTemplateParameter.ParamKind kind, char[] identifier, IASTTypeId defaultValue, IASTParameterDeclaration parameter, List parms, IASTCodeScope parameterScope, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endingOffset, int endingLine, char[] fn) { - return new ASTTemplateParameter( kind, identifier, defaultValue != null ? defaultValue.getTypeOrClassName() : "", parameter, parms, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, endingOffset, endingLine, fn ); //$NON-NLS-1$ + return new ASTTemplateParameter( kind, identifier, defaultValue != null ? defaultValue.getTypeOrClassName().toCharArray() : EMPTY_STRING, parameter, parms, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, endingOffset, endingLine, fn ); //$NON-NLS-1$ } /* (non-Javadoc) @@ -270,7 +270,7 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTypedef(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration) */ - public IASTTypedefDeclaration createTypedef(IASTScope scope, String name, IASTAbstractDeclaration mapping, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, char[] fn) + public IASTTypedefDeclaration createTypedef(IASTScope scope, char[] name, IASTAbstractDeclaration mapping, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, char[] fn) { return new ASTTypedefDeclaration( scope, name, mapping, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, fn); } @@ -289,15 +289,15 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory public IASTElaboratedTypeSpecifier createElaboratedTypeSpecifier(IASTScope scope, ASTClassKind elaboratedClassKind, ITokenDuple typeName, int startingOffset, int startingLine, int endOffset, int endingLine, boolean isForewardDecl, boolean isFriend) { - return new ASTElaboratedTypeSpecifier( scope, elaboratedClassKind, typeName.toString(), startingOffset, startingLine, typeName.getFirstToken().getOffset(), typeName.getLastToken().getEndOffset(), typeName.getLastToken().getLineNumber(), endOffset, endingLine, typeName.getFilename() ); + return new ASTElaboratedTypeSpecifier( scope, elaboratedClassKind, typeName.toCharArray(), startingOffset, startingLine, typeName.getFirstToken().getOffset(), typeName.getLastToken().getEndOffset(), typeName.getLastToken().getLineNumber(), endOffset, endingLine, typeName.getFilename() ); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createNamespaceAlias(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, org.eclipse.cdt.core.parser.ITokenDuple, int, int, int) */ - public IASTNamespaceAlias createNamespaceAlias(IASTScope scope, String identifier, ITokenDuple alias, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endOffset, int endingLine) + public IASTNamespaceAlias createNamespaceAlias(IASTScope scope, char[] identifier, ITokenDuple alias, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endOffset, int endingLine) { - return new ASTNamespaceAlias( scope, identifier, alias.toString(), startingOffset, nameOffset, nameEndOffset, endOffset, startingLine, nameLine, endingLine, alias.getFilename()); + return new ASTNamespaceAlias( scope, identifier, alias.toCharArray(), startingOffset, nameOffset, nameEndOffset, endOffset, startingLine, nameLine, endingLine, alias.getFilename()); } /* (non-Javadoc) @@ -314,7 +314,7 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory return true; // we have no information to say that it is not } - public IASTParameterDeclaration createParameterDeclaration(boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endingOffset, int endingLine, char[] fn) + public IASTParameterDeclaration createParameterDeclaration(boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, char[] parameterName, IASTInitializerClause initializerClause, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endingOffset, int endingLine, char[] fn) { return new ASTParameterDeclaration( isConst, isVolatile, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOp, parameterName, initializerClause, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, endingOffset, endingLine, fn ); } @@ -323,9 +323,9 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTypeId(org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.Type, org.eclipse.cdt.core.parser.ITokenDuple, java.util.List, java.util.List) */ public IASTTypeId createTypeId(IASTScope scope, Type kind, boolean isConst, boolean isVolatile, boolean isShort, - boolean isLong, boolean isSigned, boolean isUnsigned, boolean isTypename, ITokenDuple name, List pointerOps, List arrayMods, String completeSignature) + boolean isLong, boolean isSigned, boolean isUnsigned, boolean isTypename, ITokenDuple name, List pointerOps, List arrayMods, char[] completeSignature) { - return ( temporarilyDisableNodeConstruction ? new ASTTypeId( kind, name == null ? "" : name.toString(), pointerOps, arrayMods, isConst, //$NON-NLS-1$ + return ( temporarilyDisableNodeConstruction ? new ASTTypeId( kind, name == null ? EMPTY_STRING : name.toCharArray(), pointerOps, arrayMods, isConst, //$NON-NLS-1$ isVolatile, isUnsigned, isSigned, isShort, isLong, isTypename, completeSignature ) : null ); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/problem/BaseProblemFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/problem/BaseProblemFactory.java index 1f42de6ee02..6e2e3ba3a15 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/problem/BaseProblemFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/problem/BaseProblemFactory.java @@ -20,7 +20,7 @@ public abstract class BaseProblemFactory { protected final static String PROBLEM_PATTERN = "BaseProblemFactory.problemPattern"; //$NON-NLS-1$ - public IProblem createProblem(int id, int start, int end, int line, char[] file, String arg, boolean warn, boolean error) { + public IProblem createProblem(int id, int start, int end, int line, char[] file, char[] arg, boolean warn, boolean error) { return new Problem( id, start, end, line, file, arg, warn, error); } @@ -29,7 +29,7 @@ public abstract class BaseProblemFactory { return ( id & bitmask ) != 0; } - protected IProblem createInternalProblem( int id, int start, int end, int line, char [] file, String arg, boolean warn, boolean error ) + protected IProblem createInternalProblem( int id, int start, int end, int line, char [] file, char[] arg, boolean warn, boolean error ) { return createProblem( id, start, end, line, file, arg, warn, error ); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/problem/IProblemFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/problem/IProblemFactory.java index 2f5cfe468bb..eec469dba06 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/problem/IProblemFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/problem/IProblemFactory.java @@ -18,7 +18,7 @@ import org.eclipse.cdt.core.parser.IProblem; */ public interface IProblemFactory { - public IProblem createProblem( int id, int start, int end, int line, char [] file, String arg, boolean warn, boolean error ); + public IProblem createProblem( int id, int start, int end, int line, char [] file, char[] arg, boolean warn, boolean error ); public String getRequiredAttributesForId( int id ); } 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 bb94724fb56..2e0a2a9b578 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 @@ -23,7 +23,7 @@ import org.eclipse.cdt.internal.core.parser.ParserMessages; */ public class Problem implements IProblem { - private final String arg; + private final char[] arg; private final int id; private final int sourceStart; private final int sourceEnd; @@ -35,7 +35,7 @@ public class Problem implements IProblem { private String message = null; - public Problem( int id, int start, int end, int line, char [] file, String arg, boolean warn, boolean error ) + public Problem( int id, int start, int end, int line, char [] file, char[] arg, boolean warn, boolean error ) { this.id = id; this.sourceStart = start; @@ -236,7 +236,7 @@ public class Problem implements IProblem { * @see org.eclipse.cdt.core.parser.IProblem#getArguments() */ public String getArguments() { - return arg; + return String.valueOf(arg); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/Scanner.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/Scanner.java index ca0184d3d93..83ec99cc371 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/Scanner.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/Scanner.java @@ -125,7 +125,7 @@ public final class Scanner implements IScanner, IScannerData { getCurrentOffset(), contextStack.getCurrentLineNumber(), getCurrentFile().toCharArray(), - argument, + argument != null ? argument.toCharArray() : EMPTY_STRING_CHAR_ARRAY, warning, error ); @@ -630,8 +630,8 @@ public final class Scanner implements IScanner, IScannerData { { inclusion = getASTFactory().createInclusion( - fileName, - new String( duple.filename ), + fileName.toCharArray(), + duple.filename, !useIncludePaths, beginOffset, startLine, @@ -769,6 +769,7 @@ public final class Scanner implements IScanner, IScannerData { private boolean tokenizingMacroReplacementList = false; protected static final String EMPTY_STRING = ""; //$NON-NLS-1$ + protected static final char[] EMPTY_STRING_CHAR_ARRAY = "".toCharArray(); //$NON-NLS-1$ private Map tempMap = new HashMap(); //$NON-NLS-1$ public void setTokenizingMacroReplacementList( boolean mr ){ tokenizingMacroReplacementList = mr; @@ -2780,8 +2781,8 @@ public final class Scanner implements IScanner, IScannerData { try { i = getASTFactory().createInclusion( - directive.getFilename(), - "", //$NON-NLS-1$ + directive.getFilename().toCharArray(), + EMPTY_STRING_CHAR_ARRAY, //$NON-NLS-1$ !directive.useIncludePaths(), beginningOffset, startLine, @@ -3090,7 +3091,7 @@ public final class Scanner implements IScanner, IScannerData { try { - getASTFactory().createMacro( key, beginning, beginningLine, offset, offset + key.length(), nameLine, currentContext.getOffset(), contextStack.getCurrentLineNumber(), descriptor, getCurrentFilename() ).acceptElement( requestor, null ); + getASTFactory().createMacro( key.toCharArray(), beginning, beginningLine, offset, offset + key.length(), nameLine, currentContext.getOffset(), contextStack.getCurrentLineNumber(), descriptor, getCurrentFilename() ).acceptElement( requestor, null ); } catch (Exception e) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/ScannerProblemFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/ScannerProblemFactory.java index 29a7b5a7e06..3f2f020e228 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/ScannerProblemFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/ScannerProblemFactory.java @@ -29,7 +29,7 @@ public class ScannerProblemFactory extends BaseProblemFactory implements IProble int end, int line, char[] file, - String arg, + char[] arg, boolean warn, boolean error) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/CharArrayUtils.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/CharArrayUtils.java index 73ad00aac5d..ebffa15938e 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/CharArrayUtils.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/CharArrayUtils.java @@ -244,4 +244,17 @@ public class CharArrayUtils { return array; return subarray(array, pos + separator.length, array.length); } + + /** + * @param buff + * @param i + * @param charImage + */ + public static void overWrite( char[] buff, int i, char[] charImage ) { + if( buff.length < i + charImage.length ) + return; + for( int j = 0; j < charImage.length; j++ ){ + buff[ i + j ] = charImage[j]; + } + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/Scanner2.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/Scanner2.java index 08d19e3dba7..6a30ac6dd20 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/Scanner2.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/Scanner2.java @@ -270,6 +270,7 @@ public class Scanner2 implements IScanner, IScannerData { private boolean finished = false; private static final String EMPTY_STRING = ""; //$NON-NLS-1$ + private static final char[] EMPTY_STRING_CHAR_ARRAY = new char[0]; @@ -1183,7 +1184,7 @@ public class Scanner2 implements IScanner, IScannerData { if( parserMode == ParserMode.QUICK_PARSE ) { - IASTInclusion inclusion = getASTFactory().createInclusion( new String( filename ), EMPTY_STRING, local, startOffset, startLine, nameOffset, nameEndOffset, nameLine, endOffset, endLine, getCurrentFilename() ); + IASTInclusion inclusion = getASTFactory().createInclusion( filename.toCharArray(), EMPTY_STRING_CHAR_ARRAY, local, startOffset, startLine, nameOffset, nameEndOffset, nameLine, endOffset, endLine, getCurrentFilename() ); requestor.enterInclusion( inclusion ); requestor.exitInclusion( inclusion ); } @@ -1201,7 +1202,7 @@ public class Scanner2 implements IScanner, IScannerData { if (reader.filename != null) fileCache.put(reader.filename, reader); if (dlog != null) dlog.println("#include \"" + finalPath + "\""); //$NON-NLS-1$ //$NON-NLS-2$ - IASTInclusion inclusion = getASTFactory().createInclusion( new String( filename ), new String( reader.filename ), local, startOffset, startLine, nameOffset, nameEndOffset, nameLine, endOffset, endLine, getCurrentFilename() ); + IASTInclusion inclusion = getASTFactory().createInclusion( filename.toCharArray(), reader.filename, local, startOffset, startLine, nameOffset, nameEndOffset, nameLine, endOffset, endLine, getCurrentFilename() ); pushContext(reader.buffer, new InclusionData( reader, inclusion )); return; } @@ -1227,7 +1228,7 @@ public class Scanner2 implements IScanner, IScannerData { if (reader.filename != null) fileCache.put(reader.filename, reader); if (dlog != null) dlog.println("#include <" + finalPath + ">"); //$NON-NLS-1$ //$NON-NLS-2$ - IASTInclusion inclusion = getASTFactory().createInclusion( new String( filename ), new String( reader.filename ), local, startOffset, startLine, nameOffset, nameEndOffset, nameLine, endOffset, endLine, getCurrentFilename() ); + IASTInclusion inclusion = getASTFactory().createInclusion( filename.toCharArray(), reader.filename, local, startOffset, startLine, nameOffset, nameEndOffset, nameLine, endOffset, endLine, getCurrentFilename() ); pushContext(reader.buffer, new InclusionData( reader, inclusion )); return; } @@ -1349,7 +1350,7 @@ public class Scanner2 implements IScanner, IScannerData { ? new ObjectStyleMacro(name, text) : new FunctionStyleMacro(name, text, arglist) ); - requestor.acceptMacro( getASTFactory().createMacro( new String( name ), startingOffset, startingLine, idstart, idstart + idlen, nameLine, textstart + textlen, endingLine, null, getCurrentFilename() )); //TODO - IMacroDescriptor? + requestor.acceptMacro( getASTFactory().createMacro( name, startingOffset, startingLine, idstart, idstart + idlen, nameLine, textstart + textlen, endingLine, null, getCurrentFilename() )); //TODO - IMacroDescriptor? } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/AbstractToken.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/AbstractToken.java index e6f8b819627..5b591bc66f5 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/AbstractToken.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/AbstractToken.java @@ -193,8 +193,8 @@ public abstract class AbstractToken implements IToken, ITokenDuple { /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ITokenDuple#extractNameFromTemplateId() */ - public String extractNameFromTemplateId(){ - return getImage(); + public char[] extractNameFromTemplateId(){ + return getCharImage(); } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ITokenDuple#findLastTokenType(int) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/BasicTokenDuple.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/BasicTokenDuple.java index 1a61843bb4b..50b1f6a5bce 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/BasicTokenDuple.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/BasicTokenDuple.java @@ -19,6 +19,7 @@ import org.eclipse.cdt.core.parser.ISourceElementRequestor; import org.eclipse.cdt.core.parser.IToken; import org.eclipse.cdt.core.parser.ITokenDuple; import org.eclipse.cdt.core.parser.ast.IReferenceManager; +import org.eclipse.cdt.internal.core.parser.scanner2.CharArrayUtils; /** * @author jcamelon @@ -147,8 +148,8 @@ public class BasicTokenDuple implements ITokenDuple { return numSegments; } - private static final String EMPTY_STRING = ""; //$NON-NLS-1$ - private String stringRepresentation = null; + private static final char[] EMPTY_STRING = "".toCharArray(); //$NON-NLS-1$ + private char[] stringRepresentation = null; private class TokenIterator implements Iterator { @@ -184,12 +185,38 @@ public class BasicTokenDuple implements ITokenDuple { } - public static String createStringRepresentation( IToken f, IToken l) + public static char[] createCharArrayRepresentation( IToken f, IToken l) { - if( f == l ) return f.getImage(); - StringBuffer buff = new StringBuffer(); + if( f == l ) return f.getCharImage(); + IToken prev = null; - IToken iter = f; + IToken iter = f; + + //first figure out how long the array should be + int length = 0; + for( ; ; ){ + if( prev != null && + prev.getType() != IToken.tCOLONCOLON && + prev.getType() != IToken.tIDENTIFIER && + prev.getType() != IToken.tLT && + prev.getType() != IToken.tCOMPL && + iter.getType() != IToken.tGT && + prev.getType() != IToken.tLBRACKET && + iter.getType() != IToken.tRBRACKET && + iter.getType() != IToken.tCOLONCOLON ) + { + length++; + } + if( iter == null ) return EMPTY_STRING; + length += iter.getCharImage().length; + if( iter == l ) break; + prev = iter; + iter = iter.getNext(); + } + prev = null; + iter = f; + char[] buff = new char[ length ]; + int i = 0; for( ; ; ) { if( prev != null && @@ -201,23 +228,24 @@ public class BasicTokenDuple implements ITokenDuple { prev.getType() != IToken.tLBRACKET && iter.getType() != IToken.tRBRACKET && iter.getType() != IToken.tCOLONCOLON ) - buff.append( ' '); + buff[i++] = ' '; if( iter == null ) return EMPTY_STRING; - buff.append( iter.getImage() ); + CharArrayUtils.overWrite( buff, i, iter.getCharImage() ); + i+= iter.getCharImage().length; if( iter == l ) break; prev = iter; iter = iter.getNext(); } - return buff.toString(); + return buff; } public String toString() { if( stringRepresentation == null ) - stringRepresentation = createStringRepresentation(firstToken, lastToken); - return stringRepresentation; + stringRepresentation = createCharArrayRepresentation(firstToken, lastToken); + return String.valueOf(stringRepresentation); } public boolean isIdentifier() @@ -351,12 +379,12 @@ public class BasicTokenDuple implements ITokenDuple { return false; } - public String extractNameFromTemplateId(){ + public char[] extractNameFromTemplateId(){ ITokenDuple nameDuple = getLastSegment(); List [] argLists = getTemplateIdArgLists(); if( argLists == null || argLists[ argLists.length - 1 ] == null ) - return nameDuple.toString(); + return nameDuple.toCharArray(); Iterator i = nameDuple.iterator(); @@ -368,7 +396,7 @@ public class BasicTokenDuple implements ITokenDuple { nameBuffer.append( token.getImage() ); if( !i.hasNext() ) - return nameBuffer.toString(); + return nameBuffer.toString().toCharArray(); //appending of spaces needs to be the same as in toString() @@ -391,10 +419,10 @@ public class BasicTokenDuple implements ITokenDuple { else break; } - nameBuffer.append( createStringRepresentation( first, token ) ); + nameBuffer.append( createCharArrayRepresentation( first, token ) ); } - return nameBuffer.toString(); + return nameBuffer.toString().toCharArray(); } /* (non-Javadoc) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/ImagedToken.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/ImagedToken.java index 2003a2c9055..4a61e42b5f4 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/ImagedToken.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/ImagedToken.java @@ -45,6 +45,10 @@ public class ImagedToken extends SimpleToken { if( image == null ) return null; return new String( image ); } + + public char[] getCharImage() { + return image; + } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.IToken#setImage(java.lang.String) */ diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/TokenFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/TokenFactory.java index 0dbefadc5f1..be2a07ff28b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/TokenFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/TokenFactory.java @@ -243,7 +243,7 @@ public class TokenFactory { * @param last * @return */ - public static String createStringRepresentation(IToken first, IToken last) { - return BasicTokenDuple.createStringRepresentation(first, last); + public static char[] createCharArrayRepresentation(IToken first, IToken last) { + return BasicTokenDuple.createCharArrayRepresentation(first, last); } }