mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
@Override annotations.
This commit is contained in:
parent
cd080686aa
commit
18ec28be0f
28 changed files with 425 additions and 293 deletions
|
@ -44,10 +44,12 @@ public interface IASTExpressionList extends IASTExpression {
|
|||
/**
|
||||
* @since 5.1
|
||||
*/
|
||||
@Override
|
||||
public IASTExpressionList copy();
|
||||
|
||||
/**
|
||||
* @since 5.3
|
||||
*/
|
||||
@Override
|
||||
public IASTExpressionList copy(CopyStyle style);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ public interface IASTParameterDeclaration extends IASTNode {
|
|||
/**
|
||||
* Constant/sentinel.
|
||||
*/
|
||||
public static final IASTParameterDeclaration[] EMPTY_PARAMETERDECLARATION_ARRAY = new IASTParameterDeclaration[0];
|
||||
public static final IASTParameterDeclaration[] EMPTY_PARAMETERDECLARATION_ARRAY = {};
|
||||
|
||||
/**
|
||||
* <code>DECL_SPECIFIER</code> represents the relationship between an
|
||||
|
@ -71,10 +71,12 @@ public interface IASTParameterDeclaration extends IASTNode {
|
|||
/**
|
||||
* @since 5.1
|
||||
*/
|
||||
@Override
|
||||
public IASTParameterDeclaration copy();
|
||||
|
||||
/**
|
||||
* @since 5.3
|
||||
*/
|
||||
@Override
|
||||
public IASTParameterDeclaration copy(CopyStyle style);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ package org.eclipse.cdt.core.dom.ast;
|
|||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
public interface IASTStandardFunctionDeclarator extends IASTFunctionDeclarator {
|
||||
|
||||
/**
|
||||
* <code>FUNCTION_PARAMETER</code> represents the relationship between an
|
||||
* <code>IASTStandardFunctionDeclarator</code> and it's nested
|
||||
|
@ -67,10 +66,12 @@ public interface IASTStandardFunctionDeclarator extends IASTFunctionDeclarator {
|
|||
/**
|
||||
* @since 5.1
|
||||
*/
|
||||
@Override
|
||||
public IASTStandardFunctionDeclarator copy();
|
||||
|
||||
/**
|
||||
* @since 5.3
|
||||
*/
|
||||
@Override
|
||||
public IASTStandardFunctionDeclarator copy(CopyStyle style);
|
||||
}
|
||||
|
|
|
@ -24,8 +24,7 @@ import org.eclipse.cdt.core.dom.ast.IScope;
|
|||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
public interface ICPPASTCatchHandler extends IASTStatement {
|
||||
|
||||
public static final ICPPASTCatchHandler[] EMPTY_CATCHHANDLER_ARRAY = new ICPPASTCatchHandler[0];
|
||||
public static final ICPPASTCatchHandler[] EMPTY_CATCHHANDLER_ARRAY = {};
|
||||
|
||||
/**
|
||||
* <code>DECLARATION</code> represents the nested declaration within the catch handler.
|
||||
|
@ -78,10 +77,12 @@ public interface ICPPASTCatchHandler extends IASTStatement {
|
|||
/**
|
||||
* @since 5.1
|
||||
*/
|
||||
@Override
|
||||
public ICPPASTCatchHandler copy();
|
||||
|
||||
/**
|
||||
* @since 5.3
|
||||
*/
|
||||
@Override
|
||||
public ICPPASTCatchHandler copy(CopyStyle style);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
|||
* @noextend This interface is not intended to be extended by clients.
|
||||
*/
|
||||
public interface ICPPASTFunctionDeclarator extends IASTStandardFunctionDeclarator, ICPPASTDeclarator {
|
||||
|
||||
/**
|
||||
* Used as return value for {@link #getExceptionSpecification()}.
|
||||
* @since 5.1
|
||||
|
@ -80,6 +79,7 @@ public interface ICPPASTFunctionDeclarator extends IASTStandardFunctionDeclarato
|
|||
/**
|
||||
* @since 5.2
|
||||
*/
|
||||
@Override
|
||||
public ICPPASTParameterDeclaration[] getParameters();
|
||||
|
||||
/**
|
||||
|
@ -117,6 +117,7 @@ public interface ICPPASTFunctionDeclarator extends IASTStandardFunctionDeclarato
|
|||
* Get function scope this node represents. Returns <code>null</code>, if this declarator does not
|
||||
* declare a function-prototype or function-definition.
|
||||
*/
|
||||
@Override
|
||||
public ICPPFunctionScope getFunctionScope();
|
||||
|
||||
|
||||
|
@ -136,10 +137,12 @@ public interface ICPPASTFunctionDeclarator extends IASTStandardFunctionDeclarato
|
|||
/**
|
||||
* @since 5.1
|
||||
*/
|
||||
@Override
|
||||
public ICPPASTFunctionDeclarator copy();
|
||||
|
||||
/**
|
||||
* @since 5.3
|
||||
*/
|
||||
@Override
|
||||
public ICPPASTFunctionDeclarator copy(CopyStyle style);
|
||||
}
|
||||
|
|
|
@ -42,11 +42,13 @@ public interface ICPPASTFunctionDefinition extends IASTFunctionDefinition {
|
|||
/**
|
||||
* @since 5.1
|
||||
*/
|
||||
@Override
|
||||
public ICPPASTFunctionDefinition copy();
|
||||
|
||||
/**
|
||||
* @since 5.3
|
||||
*/
|
||||
@Override
|
||||
public ICPPASTFunctionDefinition copy(CopyStyle style);
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
|||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
public interface ICPPASTFunctionWithTryBlock extends ICPPASTFunctionDefinition {
|
||||
|
||||
/**
|
||||
* A <code>CATCH_HANDLER</code> is the role of an ICPPASTCatchHandler in
|
||||
* this interface.
|
||||
|
@ -44,6 +43,6 @@ public interface ICPPASTFunctionWithTryBlock extends ICPPASTFunctionDefinition {
|
|||
/**
|
||||
* @since 5.1
|
||||
*/
|
||||
@Override
|
||||
public ICPPASTFunctionWithTryBlock copy();
|
||||
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.eclipse.cdt.core.dom.ast.IScope;
|
|||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
public interface ICPPASTNamespaceDefinition extends IASTDeclaration, IASTNameOwner, IASTDeclarationListOwner {
|
||||
|
||||
/**
|
||||
* <code>OWNED_DECLARATION</code> is the role served by all the nested
|
||||
* declarations.
|
||||
|
@ -68,22 +67,22 @@ public interface ICPPASTNamespaceDefinition extends IASTDeclaration, IASTNameOwn
|
|||
public boolean isInline();
|
||||
|
||||
/**
|
||||
* A translation unit contains an ordered sequence of declarations.
|
||||
* A namespace contains an ordered sequence of declarations.
|
||||
*
|
||||
* @return <code>IASTDeclaration []</code>
|
||||
* @return an array of declarations contained in the namespace
|
||||
*/
|
||||
public IASTDeclaration[] getDeclarations();
|
||||
|
||||
/**
|
||||
* Add a declaration to the namespace.
|
||||
* Adds a declaration to the namespace.
|
||||
*
|
||||
* @param declaration
|
||||
* <code>IASTDeclaration</code>
|
||||
* @param declaration <code>IASTDeclaration</code>
|
||||
*/
|
||||
@Override
|
||||
public void addDeclaration(IASTDeclaration declaration);
|
||||
|
||||
/**
|
||||
* Get the scope object represented by this construct.
|
||||
* Returns the scope object represented by this construct.
|
||||
*
|
||||
* @return <code>IScope</code>
|
||||
*/
|
||||
|
@ -92,10 +91,12 @@ public interface ICPPASTNamespaceDefinition extends IASTDeclaration, IASTNameOwn
|
|||
/**
|
||||
* @since 5.1
|
||||
*/
|
||||
@Override
|
||||
public ICPPASTNamespaceDefinition copy();
|
||||
|
||||
/**
|
||||
* @since 5.3
|
||||
*/
|
||||
@Override
|
||||
public ICPPASTNamespaceDefinition copy(CopyStyle style);
|
||||
}
|
||||
|
|
|
@ -17,32 +17,31 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
|
|||
|
||||
/**
|
||||
* @author Emanuel Graf IFS
|
||||
*
|
||||
*/
|
||||
public class ASTCopyLocation implements IASTCopyLocation {
|
||||
|
||||
private IASTNode originalNode;
|
||||
|
||||
|
||||
|
||||
public ASTCopyLocation(IASTNode originalNode) {
|
||||
this.originalNode = originalNode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNodeOffset() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNodeLength() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTFileLocation asFileLocation() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTNode getOriginalNode() {
|
||||
return originalNode;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ public abstract class ASTEnumerator extends ASTNode implements IASTEnumerator, I
|
|||
copy.setOffsetAndLength(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(IASTName name) {
|
||||
assertNotFrozen();
|
||||
this.name = name;
|
||||
|
@ -49,10 +50,12 @@ public abstract class ASTEnumerator extends ASTNode implements IASTEnumerator, I
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTName getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(IASTExpression expression) {
|
||||
assertNotFrozen();
|
||||
this.value = expression;
|
||||
|
@ -62,6 +65,7 @@ public abstract class ASTEnumerator extends ASTNode implements IASTEnumerator, I
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTExpression getValue() {
|
||||
return value;
|
||||
}
|
||||
|
@ -87,6 +91,7 @@ public abstract class ASTEnumerator extends ASTNode implements IASTEnumerator, I
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRoleForName(IASTName n) {
|
||||
if (n == name)
|
||||
return r_definition;
|
||||
|
@ -94,6 +99,7 @@ public abstract class ASTEnumerator extends ASTNode implements IASTEnumerator, I
|
|||
return r_reference;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replace(IASTNode child, IASTNode other) {
|
||||
if (child == value) {
|
||||
other.setPropertyInParent(child.getPropertyInParent());
|
||||
|
|
|
@ -32,10 +32,12 @@ public abstract class ASTEqualsInitializer extends ASTNode implements IASTEquals
|
|||
setInitializerClause(arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTInitializerClause getInitializerClause() {
|
||||
return fArgument;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInitializerClause(IASTInitializerClause clause) {
|
||||
assertNotFrozen();
|
||||
fArgument = clause;
|
||||
|
@ -64,6 +66,7 @@ public abstract class ASTEqualsInitializer extends ASTNode implements IASTEquals
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replace(IASTNode child, IASTNode other) {
|
||||
if (child == fArgument) {
|
||||
other.setPropertyInParent(child.getPropertyInParent());
|
||||
|
|
|
@ -42,23 +42,29 @@ public abstract class ASTNode implements IASTNode {
|
|||
|
||||
private int length;
|
||||
private int offset;
|
||||
private IASTNodeLocation[] locations;
|
||||
private IASTFileLocation fileLocation;
|
||||
|
||||
private boolean frozen = false;
|
||||
private boolean active = true;
|
||||
|
||||
@Override
|
||||
public IASTNode getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTNode[] getChildren() {
|
||||
ChildCollector collector= new ChildCollector(this);
|
||||
return collector.getChildren();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFrozen() {
|
||||
return frozen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return active;
|
||||
}
|
||||
|
@ -78,15 +84,18 @@ public abstract class ASTNode implements IASTNode {
|
|||
throw new IllegalStateException("attempt to modify frozen AST node"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParent(IASTNode node) {
|
||||
assertNotFrozen();
|
||||
this.parent = node;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ASTNodeProperty getPropertyInParent() {
|
||||
return property;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPropertyInParent(ASTNodeProperty property) {
|
||||
assertNotFrozen();
|
||||
this.property = property;
|
||||
|
@ -120,9 +129,7 @@ public abstract class ASTNode implements IASTNode {
|
|||
setOffsetAndLength(node.getOffset(), node.getLength());
|
||||
}
|
||||
|
||||
private IASTNodeLocation[] locations = null;
|
||||
private IASTFileLocation fileLocation = null;
|
||||
|
||||
@Override
|
||||
public IASTNodeLocation[] getNodeLocations() {
|
||||
if (locations != null)
|
||||
return locations;
|
||||
|
@ -163,10 +170,12 @@ public abstract class ASTNode implements IASTNode {
|
|||
return CharArrayUtils.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRawSignature() {
|
||||
return new String(getRawSignatureChars());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContainingFilename() {
|
||||
if (offset <= 0 && (length == 0 || offset < 0)) {
|
||||
final IASTNode parent = getParent();
|
||||
|
@ -181,6 +190,7 @@ public abstract class ASTNode implements IASTNode {
|
|||
return getTranslationUnit().getContainingFilename(offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTFileLocation getFileLocation() {
|
||||
if (fileLocation != null)
|
||||
return fileLocation;
|
||||
|
@ -201,6 +211,7 @@ public abstract class ASTNode implements IASTNode {
|
|||
return fileLocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPartOfTranslationUnitFile() {
|
||||
IASTTranslationUnit ast = getTranslationUnit();
|
||||
if (ast != null) {
|
||||
|
@ -223,14 +234,17 @@ public abstract class ASTNode implements IASTNode {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTTranslationUnit getTranslationUnit() {
|
||||
return parent != null ? parent.getTranslationUnit() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accept(ASTVisitor visitor) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(IASTNode node) {
|
||||
if (node instanceof ASTNode) {
|
||||
ASTNode astNode= (ASTNode) node;
|
||||
|
@ -240,15 +254,18 @@ public abstract class ASTNode implements IASTNode {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IToken getSyntax() throws ExpansionOverlapsBoundaryException {
|
||||
return getSyntax(offset, offset+length, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IToken getLeadingSyntax() throws ExpansionOverlapsBoundaryException {
|
||||
int left= getBoundary(-1);
|
||||
return getSyntax(left, offset, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IToken getTrailingSyntax() throws ExpansionOverlapsBoundaryException {
|
||||
int right= getBoundary(1);
|
||||
return getSyntax(offset+length, right, 1);
|
||||
|
@ -346,5 +363,4 @@ public abstract class ASTNode implements IASTNode {
|
|||
protected void setCopyLocation(IASTNode originalNode) {
|
||||
locations = new IASTNodeLocation[] {new ASTCopyLocation(originalNode)};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.eclipse.cdt.internal.core.parser.scanner.ILocationResolver;
|
|||
* @since 5.0
|
||||
*/
|
||||
public class ASTNodeSelector implements IASTNodeSelector {
|
||||
|
||||
private ASTTranslationUnit fTu;
|
||||
private ILocationResolver fLocationResolver;
|
||||
private String fFilePath;
|
||||
|
@ -74,7 +73,7 @@ public class ASTNodeSelector implements IASTNodeSelector {
|
|||
sequenceLength= 0;
|
||||
if (offsetInFile > 0) {
|
||||
altSequenceNumber= fLocationResolver.getSequenceNumberForFileOffset(fFilePath, offsetInFile-1);
|
||||
if (altSequenceNumber+1 == sequenceNumber) {
|
||||
if (altSequenceNumber + 1 == sequenceNumber) {
|
||||
altSequenceNumber= -1;
|
||||
} else {
|
||||
// we are on a context boundary and we need to check the variant to the left and
|
||||
|
@ -118,55 +117,67 @@ public class ASTNodeSelector implements IASTNodeSelector {
|
|||
return nodeSpec.getBestNode();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IASTNode findFirstContainedNode(int offset, int length) {
|
||||
return findNode(offset, length, Relation.FIRST_CONTAINED, IASTNode.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTNode findNode(int offset, int length) {
|
||||
return findNode(offset, length, Relation.EXACT_MATCH, IASTNode.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTNode findEnclosingNode(int offset, int length) {
|
||||
return findNode(offset, length, Relation.ENCLOSING, IASTNode.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTNode findStrictlyEnclosingNode(int offset, int length) {
|
||||
return findNode(offset, length, Relation.STRICTLY_ENCLOSING, IASTNode.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTNode findFirstContainedNodeInExpansion(int offset, int length) {
|
||||
return findNode(offset, length, Relation.FIRST_CONTAINED, IASTNode.class, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTNode findNodeInExpansion(int offset, int length) {
|
||||
return findNode(offset, length, Relation.EXACT_MATCH, IASTNode.class, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTNode findEnclosingNodeInExpansion(int offset, int length) {
|
||||
return findNode(offset, length, Relation.ENCLOSING, IASTNode.class, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTName findFirstContainedName(int offset, int length) {
|
||||
return findNode(offset, length, Relation.FIRST_CONTAINED, IASTName.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTName findName(int offset, int length) {
|
||||
return findNode(offset, length, Relation.EXACT_MATCH, IASTName.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTName findEnclosingName(int offset, int length) {
|
||||
return findNode(offset, length, Relation.ENCLOSING, IASTName.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTImplicitName findImplicitName(int offset, int length) {
|
||||
return findNode(offset, length, Relation.EXACT_MATCH, IASTImplicitName.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTImplicitName findEnclosingImplicitName(int offset, int length) {
|
||||
return findNode(offset, length, Relation.ENCLOSING, IASTImplicitName.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTPreprocessorMacroExpansion findEnclosingMacroExpansion(int offset, int length) {
|
||||
return findNode(offset, length, Relation.ENCLOSING, IASTPreprocessorMacroExpansion.class);
|
||||
}
|
||||
|
|
|
@ -41,12 +41,12 @@ public class ASTNodeSpecification<T extends IASTNode> {
|
|||
fRelation= relation;
|
||||
fClass= clazz;
|
||||
fFileOffset= fileOffset;
|
||||
fFileEndOffset= fileOffset+fileLength;
|
||||
fFileEndOffset= fileOffset + fileLength;
|
||||
}
|
||||
|
||||
public void setRangeInSequence(int offsetInSeq, int lengthInSeq) {
|
||||
fSeqNumber= offsetInSeq;
|
||||
fSeqEndNumber= offsetInSeq+lengthInSeq;
|
||||
fSeqEndNumber= offsetInSeq + lengthInSeq;
|
||||
}
|
||||
|
||||
public void setRangeInSequence(int offsetInSeq, int lengthInSeq, boolean zeroRangeToLeft) {
|
||||
|
|
|
@ -23,95 +23,10 @@ import org.eclipse.cdt.internal.core.parser.ParserMessages;
|
|||
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
|
||||
|
||||
/**
|
||||
* Models problems, all problems should derive from this class.
|
||||
*/
|
||||
public class ASTProblem extends ASTNode implements IASTProblem {
|
||||
|
||||
private final int id;
|
||||
private final char[] arg;
|
||||
private boolean isError= false;
|
||||
|
||||
public ASTProblem(IASTNode parent, ASTNodeProperty property, int id, char[] arg, boolean isError, int startNumber, int endNumber) {
|
||||
setParent(parent);
|
||||
setPropertyInParent(property);
|
||||
setOffset(startNumber);
|
||||
setLength(endNumber-startNumber);
|
||||
|
||||
this.isError= isError;
|
||||
this.id = id;
|
||||
this.arg = arg;
|
||||
}
|
||||
|
||||
public ASTProblem(int id, char[] arg, boolean isError) {
|
||||
this.id = id;
|
||||
this.arg = arg;
|
||||
this.isError= isError;
|
||||
}
|
||||
|
||||
public ASTProblem copy() {
|
||||
return copy(CopyStyle.withoutLocations);
|
||||
}
|
||||
|
||||
public ASTProblem copy(CopyStyle style) {
|
||||
ASTProblem problem = new ASTProblem(id, arg == null ? null : arg.clone(), isError);
|
||||
problem.setOffsetAndLength(this);
|
||||
if (style == CopyStyle.withLocations) {
|
||||
problem.setCopyLocation(this);
|
||||
}
|
||||
return problem;
|
||||
}
|
||||
|
||||
public int getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public boolean isError() {
|
||||
return isError;
|
||||
}
|
||||
|
||||
public boolean isWarning() {
|
||||
return !isError;
|
||||
}
|
||||
|
||||
public String getMessageWithLocation() {
|
||||
String msg= getMessage();
|
||||
|
||||
char[] file= getOriginatingFileName();
|
||||
int line= getSourceLineNumber();
|
||||
Object[] args = new Object[] { msg, new String(file), new Integer(line) };
|
||||
return ParserMessages.getFormattedString("BaseProblemFactory.problemPattern", args); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public static String getMessage(int id, String arg) {
|
||||
String msg = errorMessages.get(new Integer(id));
|
||||
if (msg == null)
|
||||
msg = ""; //$NON-NLS-1$
|
||||
|
||||
if (arg != null) {
|
||||
return MessageFormat.format(msg, new Object[] {arg});
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return getMessage(id, arg == null ? null : new String(arg));
|
||||
}
|
||||
|
||||
public boolean checkCategory(int bitmask) {
|
||||
return ((id & bitmask) != 0);
|
||||
}
|
||||
|
||||
public String[] getArguments() {
|
||||
return arg == null ? new String[0] : new String[] {new String(arg)};
|
||||
}
|
||||
|
||||
public char[] getArgument() {
|
||||
return arg;
|
||||
}
|
||||
|
||||
|
||||
protected static final Map<Integer, String> errorMessages;
|
||||
static {
|
||||
errorMessages = new HashMap<Integer, String>();
|
||||
|
@ -179,16 +94,104 @@ public class ASTProblem extends ASTNode implements IASTProblem {
|
|||
ParserMessages.getString("ParserProblemFactory.error.syntax.missingSemicolon")); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.cdt.core.parser.IProblem#getOriginatingFileName()
|
||||
*/
|
||||
private final int id;
|
||||
private final char[] arg;
|
||||
private boolean isError;
|
||||
|
||||
public ASTProblem(IASTNode parent, ASTNodeProperty property, int id, char[] arg, boolean isError,
|
||||
int startNumber, int endNumber) {
|
||||
setParent(parent);
|
||||
setPropertyInParent(property);
|
||||
setOffset(startNumber);
|
||||
setLength(endNumber-startNumber);
|
||||
|
||||
this.isError= isError;
|
||||
this.id = id;
|
||||
this.arg = arg;
|
||||
}
|
||||
|
||||
public ASTProblem(int id, char[] arg, boolean isError) {
|
||||
this.id = id;
|
||||
this.arg = arg;
|
||||
this.isError= isError;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ASTProblem copy() {
|
||||
return copy(CopyStyle.withoutLocations);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ASTProblem copy(CopyStyle style) {
|
||||
ASTProblem problem = new ASTProblem(id, arg == null ? null : arg.clone(), isError);
|
||||
problem.setOffsetAndLength(this);
|
||||
if (style == CopyStyle.withLocations) {
|
||||
problem.setCopyLocation(this);
|
||||
}
|
||||
return problem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isError() {
|
||||
return isError;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWarning() {
|
||||
return !isError;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessageWithLocation() {
|
||||
String msg= getMessage();
|
||||
|
||||
char[] file= getOriginatingFileName();
|
||||
int line= getSourceLineNumber();
|
||||
Object[] args = new Object[] { msg, new String(file), new Integer(line) };
|
||||
return ParserMessages.getFormattedString("BaseProblemFactory.problemPattern", args); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public static String getMessage(int id, String arg) {
|
||||
String msg = errorMessages.get(new Integer(id));
|
||||
if (msg == null)
|
||||
msg = ""; //$NON-NLS-1$
|
||||
|
||||
if (arg != null) {
|
||||
return MessageFormat.format(msg, new Object[] {arg});
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return getMessage(id, arg == null ? null : new String(arg));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkCategory(int bitmask) {
|
||||
return (id & bitmask) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getArguments() {
|
||||
return arg == null ? new String[0] : new String[] { new String(arg) };
|
||||
}
|
||||
|
||||
public char[] getArgument() {
|
||||
return arg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public char[] getOriginatingFileName() {
|
||||
return getContainingFilename().toCharArray();
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.cdt.core.parser.IProblem#getSourceEnd()
|
||||
*/
|
||||
@Override
|
||||
public int getSourceEnd() {
|
||||
final IASTFileLocation location= getFileLocation();
|
||||
if (location != null) {
|
||||
|
@ -197,9 +200,7 @@ public class ASTProblem extends ASTNode implements IASTProblem {
|
|||
return INT_VALUE_NOT_PROVIDED;
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.cdt.core.parser.IProblem#getSourceLineNumber()
|
||||
*/
|
||||
@Override
|
||||
public int getSourceLineNumber() {
|
||||
final IASTFileLocation location= getFileLocation();
|
||||
if (location != null) {
|
||||
|
@ -208,9 +209,7 @@ public class ASTProblem extends ASTNode implements IASTProblem {
|
|||
return INT_VALUE_NOT_PROVIDED;
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.cdt.core.parser.IProblem#getSourceStart()
|
||||
*/
|
||||
@Override
|
||||
public int getSourceStart() {
|
||||
final IASTFileLocation location= getFileLocation();
|
||||
if (location != null) {
|
||||
|
|
|
@ -41,10 +41,12 @@ public abstract class ASTTypeIdInitializerExpression extends ASTNode implements
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTTypeId getTypeId() {
|
||||
return typeId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTypeId(IASTTypeId typeId) {
|
||||
assertNotFrozen();
|
||||
this.typeId = typeId;
|
||||
|
@ -54,10 +56,12 @@ public abstract class ASTTypeIdInitializerExpression extends ASTNode implements
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTInitializer getInitializer() {
|
||||
return initializer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInitializer(IASTInitializer initializer) {
|
||||
assertNotFrozen();
|
||||
this.initializer = initializer;
|
||||
|
@ -68,32 +72,34 @@ public abstract class ASTTypeIdInitializerExpression extends ASTNode implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean accept( ASTVisitor action ){
|
||||
if( action.shouldVisitExpressions ){
|
||||
switch( action.visit( this ) ){
|
||||
case ASTVisitor.PROCESS_ABORT : return false;
|
||||
case ASTVisitor.PROCESS_SKIP : return true;
|
||||
default : break;
|
||||
public boolean accept(ASTVisitor action) {
|
||||
if (action.shouldVisitExpressions) {
|
||||
switch(action.visit(this)) {
|
||||
case ASTVisitor.PROCESS_ABORT: return false;
|
||||
case ASTVisitor.PROCESS_SKIP: return true;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
if( typeId != null ) if( !typeId.accept( action ) ) return false;
|
||||
if( initializer != null ) if( !initializer.accept( action ) ) return false;
|
||||
if (typeId != null && !typeId.accept(action)) return false;
|
||||
if (initializer != null && !initializer.accept(action)) return false;
|
||||
|
||||
if( action.shouldVisitExpressions ){
|
||||
switch( action.leave( this ) ){
|
||||
case ASTVisitor.PROCESS_ABORT : return false;
|
||||
case ASTVisitor.PROCESS_SKIP : return true;
|
||||
default : break;
|
||||
if (action.shouldVisitExpressions) {
|
||||
switch(action.leave(this)) {
|
||||
case ASTVisitor.PROCESS_ABORT: return false;
|
||||
case ASTVisitor.PROCESS_SKIP: return true;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isLValue() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final ValueCategory getValueCategory() {
|
||||
return ValueCategory.PRVALUE;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
|||
private static final Map<String, char[]> CHAR_ARRAYS = new HashMap<String, char[]>();
|
||||
|
||||
private IBinding[] fBindings;
|
||||
private IScope fScope= null;
|
||||
private IScope fScope;
|
||||
private final boolean fCpp;
|
||||
private final boolean fGnu;
|
||||
|
||||
|
@ -75,6 +75,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
|||
fGnu= supportGnuSymbols;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinding[] getBuiltinBindings(IScope scope) {
|
||||
fScope= scope;
|
||||
initialize();
|
||||
|
|
|
@ -13,22 +13,24 @@ package org.eclipse.cdt.internal.core.dom.parser;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier;
|
||||
|
||||
/**
|
||||
* Internal interface for c- or c++ enumeration specifiers.
|
||||
* Internal interface for C or C++ enumeration specifiers.
|
||||
*/
|
||||
public interface IASTInternalEnumerationSpecifier extends IASTEnumerationSpecifier {
|
||||
/**
|
||||
* Notifies that the value computation for the enumeration is started. Returns whether this is the
|
||||
* first attempt to do so.
|
||||
* Notifies that the value computation for the enumeration is started. Returns whether this is
|
||||
* the first attempt to do so.
|
||||
*/
|
||||
boolean startValueComputation();
|
||||
|
||||
/**
|
||||
* @since 5.1
|
||||
*/
|
||||
@Override
|
||||
public IASTInternalEnumerationSpecifier copy();
|
||||
|
||||
/**
|
||||
* @since 5.3
|
||||
*/
|
||||
@Override
|
||||
public IASTInternalEnumerationSpecifier copy(CopyStyle style);
|
||||
}
|
||||
|
|
|
@ -18,15 +18,18 @@ import org.eclipse.cdt.core.dom.ast.INodeFactory;
|
|||
*/
|
||||
public abstract class NodeFactory implements INodeFactory {
|
||||
|
||||
@Override
|
||||
public final void setOffsets(IASTNode node, int offset, int endOffset) {
|
||||
((ASTNode) node).setOffsetAndLength(offset, endOffset-offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setEndOffset(IASTNode node, int endOffset) {
|
||||
ASTNode a= (ASTNode) node;
|
||||
a.setLength(endOffset - a.getOffset());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setEndOffset(IASTNode node, IASTNode endNode) {
|
||||
ASTNode a= (ASTNode) node;
|
||||
ASTNode e= (ASTNode) endNode;
|
||||
|
|
|
@ -36,26 +36,32 @@ public class ProblemFunctionType extends ProblemType implements ICPPFunctionType
|
|||
return new ProblemFunctionType(buffer.getShort());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IType getReturnType() {
|
||||
return new ProblemType(getID());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IType[] getParameterTypes() {
|
||||
return new IType[] {new ProblemType(getID())};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConst() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVolatile() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean takesVarArgs() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPointerType getThisType() {
|
||||
return new CPPPointerType(new ProblemType(getID()));
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import org.eclipse.cdt.core.dom.ast.IType;
|
|||
import org.eclipse.cdt.internal.core.parser.ParserMessages;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of problem types.
|
||||
*/
|
||||
|
@ -28,14 +27,17 @@ public class ProblemType implements IProblemType, ISerializableType {
|
|||
fID= id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getID() {
|
||||
return fID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return ParserMessages.getProblemPattern(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSameType(IType type) {
|
||||
return type == this;
|
||||
}
|
||||
|
@ -49,6 +51,7 @@ public class ProblemType implements IProblemType, ISerializableType {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void marshal(ITypeMarshalBuffer buffer) throws CoreException {
|
||||
buffer.putByte(ITypeMarshalBuffer.PROBLEM_TYPE);
|
||||
buffer.putShort((short) getID());
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
|||
* @author jcamelon
|
||||
*/
|
||||
public class CPPASTCatchHandler extends ASTNode implements ICPPASTCatchHandler, IASTAmbiguityParent {
|
||||
|
||||
private boolean isCatchAll;
|
||||
private IASTStatement body;
|
||||
private IASTDeclaration declaration;
|
||||
|
@ -38,10 +37,12 @@ public class CPPASTCatchHandler extends ASTNode implements ICPPASTCatchHandler,
|
|||
setDeclaration(declaration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CPPASTCatchHandler copy() {
|
||||
return copy(CopyStyle.withoutLocations);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CPPASTCatchHandler copy(CopyStyle style) {
|
||||
CPPASTCatchHandler copy = new CPPASTCatchHandler();
|
||||
copy.setDeclaration(declaration == null ? null : declaration.copy(style));
|
||||
|
@ -54,15 +55,18 @@ public class CPPASTCatchHandler extends ASTNode implements ICPPASTCatchHandler,
|
|||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIsCatchAll(boolean isEllipsis) {
|
||||
assertNotFrozen();
|
||||
isCatchAll = isEllipsis;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCatchAll() {
|
||||
return isCatchAll;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCatchBody(IASTStatement compoundStatement) {
|
||||
assertNotFrozen();
|
||||
body = compoundStatement;
|
||||
|
@ -72,10 +76,12 @@ public class CPPASTCatchHandler extends ASTNode implements ICPPASTCatchHandler,
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTStatement getCatchBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDeclaration(IASTDeclaration decl) {
|
||||
assertNotFrozen();
|
||||
declaration = decl;
|
||||
|
@ -85,48 +91,48 @@ public class CPPASTCatchHandler extends ASTNode implements ICPPASTCatchHandler,
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTDeclaration getDeclaration() {
|
||||
return declaration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accept( ASTVisitor action ){
|
||||
if( action.shouldVisitStatements ){
|
||||
switch( action.visit( this ) ){
|
||||
case ASTVisitor.PROCESS_ABORT : return false;
|
||||
case ASTVisitor.PROCESS_SKIP : return true;
|
||||
default : break;
|
||||
public boolean accept(ASTVisitor action) {
|
||||
if (action.shouldVisitStatements) {
|
||||
switch (action.visit(this)) {
|
||||
case ASTVisitor.PROCESS_ABORT: return false;
|
||||
case ASTVisitor.PROCESS_SKIP: return true;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
if( declaration != null ) if( !declaration.accept( action ) ) return false;
|
||||
if( body != null ) if( !body.accept( action ) ) return false;
|
||||
if (declaration != null && !declaration.accept(action)) return false;
|
||||
if (body != null && !body.accept(action)) return false;
|
||||
|
||||
if( action.shouldVisitStatements ){
|
||||
switch( action.leave( this ) ){
|
||||
case ASTVisitor.PROCESS_ABORT : return false;
|
||||
case ASTVisitor.PROCESS_SKIP : return true;
|
||||
default : break;
|
||||
if (action.shouldVisitStatements) {
|
||||
switch (action.leave(this)) {
|
||||
case ASTVisitor.PROCESS_ABORT: return false;
|
||||
case ASTVisitor.PROCESS_SKIP: return true;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replace(IASTNode child, IASTNode other) {
|
||||
if( body == child )
|
||||
{
|
||||
other.setPropertyInParent( child.getPropertyInParent() );
|
||||
other.setParent( child.getParent() );
|
||||
if (body == child) {
|
||||
other.setPropertyInParent(child.getPropertyInParent());
|
||||
other.setParent(child.getParent());
|
||||
body = (IASTStatement) other;
|
||||
}
|
||||
if( declaration == child )
|
||||
{
|
||||
other.setParent( child.getParent() );
|
||||
other.setPropertyInParent( child.getPropertyInParent() );
|
||||
if (declaration == child) {
|
||||
other.setParent(child.getParent());
|
||||
other.setPropertyInParent(child.getPropertyInParent());
|
||||
declaration = (IASTDeclaration) other;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IScope getScope() {
|
||||
if (scope == null) {
|
||||
scope = new CPPBlockScope(this);
|
||||
|
|
|
@ -77,6 +77,7 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements ICPPAS
|
|||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICPPASTParameterDeclaration[] getParameters() {
|
||||
if (parameters == null)
|
||||
return ICPPASTParameterDeclaration.EMPTY_CPPPARAMETERDECLARATION_ARRAY;
|
||||
|
@ -84,6 +85,7 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements ICPPAS
|
|||
return parameters= ArrayUtil.trim(parameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addParameterDeclaration(IASTParameterDeclaration parameter) {
|
||||
assertNotFrozen();
|
||||
if (parameter != null) {
|
||||
|
@ -93,51 +95,62 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements ICPPAS
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean takesVarArgs() {
|
||||
return varArgs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVarArgs(boolean value) {
|
||||
assertNotFrozen();
|
||||
varArgs = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConst() {
|
||||
return isConst;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConst(boolean value) {
|
||||
assertNotFrozen();
|
||||
this.isConst = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVolatile() {
|
||||
return isVolatile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVolatile(boolean value) {
|
||||
assertNotFrozen();
|
||||
this.isVolatile = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMutable() {
|
||||
return isMutable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMutable(boolean value) {
|
||||
assertNotFrozen();
|
||||
this.isMutable = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTTypeId[] getExceptionSpecification() {
|
||||
return typeIds= ArrayUtil.trim(typeIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEmptyExceptionSpecification() {
|
||||
assertNotFrozen();
|
||||
typeIds= IASTTypeId.EMPTY_TYPEID_ARRAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addExceptionSpecificationTypeId(IASTTypeId typeId) {
|
||||
assertNotFrozen();
|
||||
if (typeId != null) {
|
||||
|
@ -148,11 +161,12 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements ICPPAS
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IASTTypeId getTrailingReturnType() {
|
||||
return trailingReturnType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTrailingReturnType(IASTTypeId typeId) {
|
||||
assertNotFrozen();
|
||||
trailingReturnType= typeId;
|
||||
|
@ -162,20 +176,23 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements ICPPAS
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPureVirtual() {
|
||||
return pureVirtual;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPureVirtual(boolean isPureVirtual) {
|
||||
assertNotFrozen();
|
||||
this.pureVirtual = isPureVirtual;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer[] getConstructorChain() {
|
||||
if (ASTQueries.findTypeRelevantDeclarator(this) == this) {
|
||||
IASTNode parent= getParent();
|
||||
while(!(parent instanceof IASTDeclaration)) {
|
||||
while (!(parent instanceof IASTDeclaration)) {
|
||||
if (parent == null)
|
||||
break;
|
||||
parent= parent.getParent();
|
||||
|
@ -187,18 +204,20 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements ICPPAS
|
|||
return org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer.EMPTY_CONSTRUCTORCHAININITIALIZER_ARRAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void addConstructorToChain(org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer initializer) {
|
||||
assertNotFrozen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICPPFunctionScope getFunctionScope() {
|
||||
if (scope != null)
|
||||
return scope;
|
||||
|
||||
// introduce a scope for function declarations and definitions, only.
|
||||
IASTNode node= getParent();
|
||||
while(!(node instanceof IASTDeclaration)) {
|
||||
while (!(node instanceof IASTDeclaration)) {
|
||||
if (node==null)
|
||||
return null;
|
||||
node= node.getParent();
|
||||
|
@ -232,6 +251,7 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements ICPPAS
|
|||
return super.postAccept(action);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replace(IASTNode child, IASTNode other) {
|
||||
if (parameters != null) {
|
||||
for (int i = 0; i < parameters.length; ++i) {
|
||||
|
|
|
@ -24,6 +24,8 @@ import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
|||
* @see ICPPASTFunctionWithTryBlock
|
||||
*/
|
||||
public class CPPASTFunctionWithTryBlock extends CPPASTFunctionDefinition implements ICPPASTFunctionWithTryBlock {
|
||||
private ICPPASTCatchHandler[] catchHandlers;
|
||||
private int catchHandlersPos= -1;
|
||||
|
||||
public CPPASTFunctionWithTryBlock() {
|
||||
}
|
||||
|
@ -49,10 +51,12 @@ public class CPPASTFunctionWithTryBlock extends CPPASTFunctionDefinition impleme
|
|||
copy.setDeclarator(declarator == null ? null : declarator.copy(style));
|
||||
copy.setBody(bodyStatement == null ? null : bodyStatement.copy(style));
|
||||
|
||||
for (ICPPASTConstructorChainInitializer initializer : getMemberInitializers())
|
||||
for (ICPPASTConstructorChainInitializer initializer : getMemberInitializers()) {
|
||||
copy.addMemberInitializer(initializer == null ? null : initializer.copy(style));
|
||||
for (ICPPASTCatchHandler handler : getCatchHandlers())
|
||||
}
|
||||
for (ICPPASTCatchHandler handler : getCatchHandlers()) {
|
||||
copy.addCatchHandler(handler == null ? null : handler.copy(style));
|
||||
}
|
||||
|
||||
copy.setOffsetAndLength(this);
|
||||
if (style == CopyStyle.withLocations) {
|
||||
|
@ -61,29 +65,27 @@ public class CPPASTFunctionWithTryBlock extends CPPASTFunctionDefinition impleme
|
|||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCatchHandler(ICPPASTCatchHandler statement) {
|
||||
assertNotFrozen();
|
||||
if (statement != null) {
|
||||
catchHandlers = (ICPPASTCatchHandler[]) ArrayUtil.append( ICPPASTCatchHandler.class, catchHandlers, ++catchHandlersPos, statement );
|
||||
catchHandlers = (ICPPASTCatchHandler[]) ArrayUtil.append(ICPPASTCatchHandler.class, catchHandlers, ++catchHandlersPos, statement);
|
||||
statement.setParent(this);
|
||||
statement.setPropertyInParent(CATCH_HANDLER);
|
||||
}
|
||||
}
|
||||
|
||||
public ICPPASTCatchHandler [] getCatchHandlers() {
|
||||
if( catchHandlers == null ) return ICPPASTCatchHandler.EMPTY_CATCHHANDLER_ARRAY;
|
||||
catchHandlers = (ICPPASTCatchHandler[]) ArrayUtil.removeNullsAfter( ICPPASTCatchHandler.class, catchHandlers, catchHandlersPos );
|
||||
@Override
|
||||
public ICPPASTCatchHandler[] getCatchHandlers() {
|
||||
if (catchHandlers == null) return ICPPASTCatchHandler.EMPTY_CATCHHANDLER_ARRAY;
|
||||
catchHandlers = (ICPPASTCatchHandler[]) ArrayUtil.removeNullsAfter(ICPPASTCatchHandler.class, catchHandlers, catchHandlersPos);
|
||||
return catchHandlers;
|
||||
}
|
||||
|
||||
|
||||
private ICPPASTCatchHandler [] catchHandlers = null;
|
||||
private int catchHandlersPos=-1;
|
||||
|
||||
@Override
|
||||
protected boolean acceptCatchHandlers( ASTVisitor action ){
|
||||
final ICPPASTCatchHandler [] handlers = getCatchHandlers();
|
||||
for (int i=0; i<handlers.length; i++) {
|
||||
protected boolean acceptCatchHandlers(ASTVisitor action) {
|
||||
final ICPPASTCatchHandler[] handlers = getCatchHandlers();
|
||||
for (int i= 0; i < handlers.length; i++) {
|
||||
if (!handlers[i].accept(action))
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -32,10 +32,12 @@ public class CPPASTSimpleDeclaration extends ASTNode implements IASTSimpleDeclar
|
|||
setDeclSpecifier(declSpecifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CPPASTSimpleDeclaration copy() {
|
||||
return copy(CopyStyle.withoutLocations);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CPPASTSimpleDeclaration copy(CopyStyle style) {
|
||||
CPPASTSimpleDeclaration copy = new CPPASTSimpleDeclaration();
|
||||
copy.setDeclSpecifier(declSpecifier == null ? null : declSpecifier.copy(style));
|
||||
|
@ -48,16 +50,20 @@ public class CPPASTSimpleDeclaration extends ASTNode implements IASTSimpleDeclar
|
|||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTDeclSpecifier getDeclSpecifier() {
|
||||
return declSpecifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTDeclarator[] getDeclarators() {
|
||||
if (declarators == null) return IASTDeclarator.EMPTY_DECLARATOR_ARRAY;
|
||||
if (declarators == null)
|
||||
return IASTDeclarator.EMPTY_DECLARATOR_ARRAY;
|
||||
declarators = (IASTDeclarator[]) ArrayUtil.removeNullsAfter(IASTDeclarator.class, declarators, declaratorsPos);
|
||||
return declarators;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDeclarator(IASTDeclarator d) {
|
||||
assertNotFrozen();
|
||||
if (d != null) {
|
||||
|
@ -67,13 +73,14 @@ public class CPPASTSimpleDeclaration extends ASTNode implements IASTSimpleDeclar
|
|||
}
|
||||
}
|
||||
|
||||
private IASTDeclarator[] declarators = null;
|
||||
private IASTDeclarator[] declarators;
|
||||
private int declaratorsPos = -1;
|
||||
private IASTDeclSpecifier declSpecifier;
|
||||
|
||||
/**
|
||||
* @param declSpecifier The declSpecifier to set.
|
||||
*/
|
||||
@Override
|
||||
public void setDeclSpecifier(IASTDeclSpecifier declSpecifier) {
|
||||
assertNotFrozen();
|
||||
this.declSpecifier = declSpecifier;
|
||||
|
@ -93,10 +100,12 @@ public class CPPASTSimpleDeclaration extends ASTNode implements IASTSimpleDeclar
|
|||
}
|
||||
}
|
||||
|
||||
if (declSpecifier != null) if (!declSpecifier.accept(action)) return false;
|
||||
if (declSpecifier != null && !declSpecifier.accept(action)) return false;
|
||||
IASTDeclarator[] dtors = getDeclarators();
|
||||
for (int i = 0; i < dtors.length; i++)
|
||||
if (!dtors[i].accept(action)) return false;
|
||||
for (int i = 0; i < dtors.length; i++) {
|
||||
if (!dtors[i].accept(action))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (action.shouldVisitDeclarations) {
|
||||
switch (action.leave(this)) {
|
||||
|
@ -108,6 +117,7 @@ public class CPPASTSimpleDeclaration extends ASTNode implements IASTSimpleDeclar
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replace(IASTNode child, IASTNode other) {
|
||||
IASTDeclarator[] declarators = getDeclarators();
|
||||
for (int i = 0; i < declarators.length; i++) {
|
||||
|
|
|
@ -25,7 +25,6 @@ public class CPPASTTypeId extends ASTNode implements ICPPASTTypeId {
|
|||
private IASTDeclarator absDecl;
|
||||
private boolean isPackExpansion;
|
||||
|
||||
|
||||
public CPPASTTypeId() {
|
||||
}
|
||||
|
||||
|
@ -34,10 +33,12 @@ public class CPPASTTypeId extends ASTNode implements ICPPASTTypeId {
|
|||
setAbstractDeclarator(absDecl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CPPASTTypeId copy() {
|
||||
return copy(CopyStyle.withoutLocations);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CPPASTTypeId copy(CopyStyle style) {
|
||||
CPPASTTypeId copy = new CPPASTTypeId();
|
||||
copy.setDeclSpecifier(declSpec == null ? null : declSpec.copy(style));
|
||||
|
@ -50,10 +51,12 @@ public class CPPASTTypeId extends ASTNode implements ICPPASTTypeId {
|
|||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTDeclSpecifier getDeclSpecifier() {
|
||||
return declSpec;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDeclSpecifier(IASTDeclSpecifier declSpec) {
|
||||
assertNotFrozen();
|
||||
this.declSpec = declSpec;
|
||||
|
@ -63,11 +66,12 @@ public class CPPASTTypeId extends ASTNode implements ICPPASTTypeId {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTDeclarator getAbstractDeclarator() {
|
||||
return absDecl;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setAbstractDeclarator(IASTDeclarator abstractDeclarator) {
|
||||
assertNotFrozen();
|
||||
this.absDecl = abstractDeclarator;
|
||||
|
@ -77,10 +81,12 @@ public class CPPASTTypeId extends ASTNode implements ICPPASTTypeId {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPackExpansion() {
|
||||
return isPackExpansion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIsPackExpansion(boolean val) {
|
||||
isPackExpansion= val;
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@ public class LocationMap implements ILocationResolver {
|
|||
fLexerOptions= lexOptions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexerOptions getLexerOptions() {
|
||||
return fLexerOptions;
|
||||
}
|
||||
|
@ -382,6 +383,7 @@ public class LocationMap implements ILocationResolver {
|
|||
addMacroReference(undef.getMacroName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRootNode(IASTTranslationUnit root) {
|
||||
fTranslationUnit= root;
|
||||
if (fTranslationUnit instanceof ISkippedIndexedFilesListener) {
|
||||
|
@ -389,6 +391,7 @@ public class LocationMap implements ILocationResolver {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTranslationUnitPath() {
|
||||
return fTranslationUnitPath;
|
||||
}
|
||||
|
@ -418,11 +421,13 @@ public class LocationMap implements ILocationResolver {
|
|||
return fCurrentContext.getSequenceNumberForOffset(offset, offset < fLastChildInsertionOffset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContainingFilePath(int sequenceNumber) {
|
||||
LocationCtx ctx= fRootContext.findSurroundingContext(sequenceNumber, 1);
|
||||
return new String(ctx.getFilePath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPartOfSourceFile(int sequenceNumber) {
|
||||
LocationCtx ctx= fRootContext.findSurroundingContext(sequenceNumber, 1);
|
||||
if (ctx == fRootContext && fTranslationUnit != null)
|
||||
|
@ -431,14 +436,17 @@ public class LocationMap implements ILocationResolver {
|
|||
return ctx.isSourceFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ASTFileLocation getMappedFileLocation(int sequenceNumber, int length) {
|
||||
return fRootContext.findMappedFileLocation(sequenceNumber, length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int convertToSequenceEndNumber(int sequenceNumber) {
|
||||
return fRootContext.convertToSequenceEndNumber(sequenceNumber);
|
||||
}
|
||||
|
||||
@Override
|
||||
public char[] getUnpreprocessedSignature(IASTFileLocation loc) {
|
||||
ASTFileLocation floc= convertFileLocation(loc);
|
||||
if (floc == null) {
|
||||
|
@ -447,6 +455,7 @@ public class LocationMap implements ILocationResolver {
|
|||
return floc.getSource();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTPreprocessorMacroExpansion[] getMacroExpansions(IASTFileLocation loc) {
|
||||
ASTFileLocation floc= convertFileLocation(loc);
|
||||
if (floc == null) {
|
||||
|
@ -485,17 +494,19 @@ public class LocationMap implements ILocationResolver {
|
|||
return getMappedFileLocation(sequenceNumber, length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTNodeLocation[] getLocations(int sequenceNumber, int length) {
|
||||
ArrayList<IASTNodeLocation> result= new ArrayList<IASTNodeLocation>();
|
||||
fRootContext.collectLocations(sequenceNumber, length, result);
|
||||
return result.toArray(new IASTNodeLocation[result.size()]);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isPartOfTranslationUnitFile(int sequenceNumber) {
|
||||
return fRootContext.isThisFile(sequenceNumber);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTImageLocation getImageLocation(int sequenceNumber, int length) {
|
||||
ArrayList<IASTNodeLocation> result= new ArrayList<IASTNodeLocation>();
|
||||
fRootContext.collectLocations(sequenceNumber, length, result);
|
||||
|
@ -515,6 +526,7 @@ public class LocationMap implements ILocationResolver {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findPreprocessorNode(ASTNodeSpecification<?> nodeSpec) {
|
||||
final int sequenceStart= nodeSpec.getSequenceStart();
|
||||
final int sequenceEnd= nodeSpec.getSequenceEnd();
|
||||
|
@ -600,6 +612,7 @@ public class LocationMap implements ILocationResolver {
|
|||
return lower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSequenceNumberForFileOffset(String filePath, int fileOffset) {
|
||||
LocationCtx ctx= fRootContext;
|
||||
if (filePath != null) {
|
||||
|
@ -624,6 +637,7 @@ public class LocationMap implements ILocationResolver {
|
|||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTFileLocation flattenLocations(IASTNodeLocation[] locations) {
|
||||
if (locations.length == 0) {
|
||||
return null;
|
||||
|
@ -643,7 +657,7 @@ public class LocationMap implements ILocationResolver {
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IASTPreprocessorMacroDefinition[] getMacroDefinitions() {
|
||||
ArrayList<Object> result= new ArrayList<Object>();
|
||||
for (Iterator<ASTPreprocessorNode> iterator = fDirectives.iterator(); iterator.hasNext();) {
|
||||
|
@ -655,6 +669,7 @@ public class LocationMap implements ILocationResolver {
|
|||
return result.toArray(new IASTPreprocessorMacroDefinition[result.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTPreprocessorIncludeStatement[] getIncludeDirectives() {
|
||||
ArrayList<Object> result= new ArrayList<Object>();
|
||||
for (Iterator<ASTPreprocessorNode> iterator = fDirectives.iterator(); iterator.hasNext();) {
|
||||
|
@ -666,26 +681,32 @@ public class LocationMap implements ILocationResolver {
|
|||
return result.toArray(new IASTPreprocessorIncludeStatement[result.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTComment[] getComments() {
|
||||
return fComments.toArray(new IASTComment[fComments.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTPreprocessorStatement[] getAllPreprocessorStatements() {
|
||||
return fDirectives.toArray(new IASTPreprocessorStatement[fDirectives.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTPreprocessorMacroDefinition[] getBuiltinMacroDefinitions() {
|
||||
return fBuiltinMacros.toArray(new IASTPreprocessorMacroDefinition[fBuiltinMacros.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTProblem[] getScannerProblems() {
|
||||
return fProblems.toArray(new IASTProblem[fProblems.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getScannerProblemsCount() {
|
||||
return fProblems.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTName[] getDeclarations(IMacroBinding binding) {
|
||||
IASTPreprocessorMacroDefinition def = getMacroDefinition(binding);
|
||||
return def == null ? IASTName.EMPTY_NAME_ARRAY: new IASTName[] { def.getName() };
|
||||
|
@ -712,6 +733,7 @@ public class LocationMap implements ILocationResolver {
|
|||
return fMacroDefinitionMap.get(binding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTName[] getReferences(IMacroBinding binding) {
|
||||
List<IASTName> result= new ArrayList<IASTName>();
|
||||
for (IASTName name : fMacroReferences) {
|
||||
|
@ -737,6 +759,7 @@ public class LocationMap implements ILocationResolver {
|
|||
return result.toArray(new ASTPreprocessorName[result.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDependencyTree getDependencyTree() {
|
||||
return new DependencyTree(fRootContext);
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* Aaron Luchko, aluchko@redhat.com - 105926 [Formatter] Exporting Unnamed profile fails silently
|
||||
* Sergey Prigogin, Google
|
||||
* Aaron Luchko, aluchko@redhat.com - 105926 [Formatter] Exporting unnamed profile fails silently
|
||||
* Sergey Prigogin (Google)
|
||||
* Anton Leherbauer (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.preferences.formatter;
|
||||
|
@ -32,7 +32,6 @@ import org.eclipse.cdt.internal.ui.preferences.formatter.ProfileManager.Profile;
|
|||
* The code formatter preference page.
|
||||
*/
|
||||
public class CodeFormatterConfigurationBlock extends ProfileConfigurationBlock {
|
||||
|
||||
private static final String FORMATTER_DIALOG_PREFERENCE_KEY= "formatter_page"; //$NON-NLS-1$
|
||||
|
||||
private static final String DIALOGSTORE_LASTSAVELOADPATH= CUIPlugin.PLUGIN_ID + ".codeformatter.savepath"; //$NON-NLS-1$
|
||||
|
@ -46,6 +45,7 @@ public class CodeFormatterConfigurationBlock extends ProfileConfigurationBlock {
|
|||
fCodeStylePreview.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Observable o, Object arg) {
|
||||
if (o == fCustomCodeFormatterBlock) {
|
||||
fCodeStylePreview.setFormatterId((String)arg);
|
||||
|
@ -173,5 +173,4 @@ public class CodeFormatterConfigurationBlock extends ProfileConfigurationBlock {
|
|||
}
|
||||
return super.performOk();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue