mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 09:46:02 +02:00
Fixed compiler warnings.
Change-Id: I6617c9cf0564c8011da4f35f41cbae29c453adfa
This commit is contained in:
parent
d6d135d701
commit
0937af705b
2 changed files with 20 additions and 15 deletions
|
@ -21,7 +21,6 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTForStatement;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTForStatement;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.DestructorCallCollector;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.DestructorCallCollector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,14 +28,14 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.DestructorCallColl
|
||||||
*/
|
*/
|
||||||
public class CPPASTForStatement extends CPPASTAttributeOwner implements ICPPASTForStatement {
|
public class CPPASTForStatement extends CPPASTAttributeOwner implements ICPPASTForStatement {
|
||||||
private IScope fScope;
|
private IScope fScope;
|
||||||
|
|
||||||
private IASTStatement fInit;
|
private IASTStatement fInit;
|
||||||
private IASTExpression fCondition;
|
private IASTExpression fCondition;
|
||||||
private IASTDeclaration fCondDeclaration;
|
private IASTDeclaration fCondDeclaration;
|
||||||
private IASTExpression fIterationExpression;
|
private IASTExpression fIterationExpression;
|
||||||
private IASTStatement fBody;
|
private IASTStatement fBody;
|
||||||
private IASTImplicitDestructorName[] fImplicitDestructorNames;
|
private IASTImplicitDestructorName[] fImplicitDestructorNames;
|
||||||
|
|
||||||
public CPPASTForStatement() {
|
public CPPASTForStatement() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +59,7 @@ public class CPPASTForStatement extends CPPASTAttributeOwner implements ICPPASTF
|
||||||
public CPPASTForStatement copy() {
|
public CPPASTForStatement copy() {
|
||||||
return copy(CopyStyle.withoutLocations);
|
return copy(CopyStyle.withoutLocations);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CPPASTForStatement copy(CopyStyle style) {
|
public CPPASTForStatement copy(CopyStyle style) {
|
||||||
CPPASTForStatement copy = new CPPASTForStatement();
|
CPPASTForStatement copy = new CPPASTForStatement();
|
||||||
|
@ -164,7 +163,7 @@ public class CPPASTForStatement extends CPPASTAttributeOwner implements ICPPASTF
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void replace(IASTNode child, IASTNode other) {
|
public void replace(IASTNode child, IASTNode other) {
|
||||||
if (fBody == child) {
|
if (fBody == child) {
|
||||||
|
|
|
@ -22,7 +22,11 @@ import org.eclipse.cdt.core.parser.Keywords;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNodeSearch;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTNodeSearch;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An implicit name is used to resolve uses of implicit bindings, such as overloaded operators.
|
||||||
|
*
|
||||||
|
* @see IASTImplicitName
|
||||||
|
*/
|
||||||
public class CPPASTImplicitName extends CPPASTName implements IASTImplicitName {
|
public class CPPASTImplicitName extends CPPASTName implements IASTImplicitName {
|
||||||
private boolean alternate;
|
private boolean alternate;
|
||||||
private boolean isOperator;
|
private boolean isOperator;
|
||||||
|
@ -89,7 +93,7 @@ public class CPPASTImplicitName extends CPPASTName implements IASTImplicitName {
|
||||||
public boolean isReference() {
|
public boolean isReference() {
|
||||||
return !isDefinition;
|
return !isDefinition;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIsDefinition(boolean val) {
|
public void setIsDefinition(boolean val) {
|
||||||
isDefinition= val;
|
isDefinition= val;
|
||||||
}
|
}
|
||||||
|
@ -128,7 +132,7 @@ public class CPPASTImplicitName extends CPPASTName implements IASTImplicitName {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback algorithm to use in computeOperatorOffsets() when the operator is
|
// Fallback algorithm to use in computeOperatorOffsets() when the operator is
|
||||||
// in a macro expansion.
|
// in a macro expansion.
|
||||||
private boolean computeOperatorOffsetsFallback(IASTNode relativeNode, boolean trailing) {
|
private boolean computeOperatorOffsetsFallback(IASTNode relativeNode, boolean trailing) {
|
||||||
|
@ -136,34 +140,36 @@ public class CPPASTImplicitName extends CPPASTName implements IASTImplicitName {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ASTNode relative = (ASTNode) relativeNode;
|
ASTNode relative = (ASTNode) relativeNode;
|
||||||
|
|
||||||
// Find the sequence numbers denoting the bounds of the leading or
|
// Find the sequence numbers denoting the bounds of the leading or
|
||||||
// trailing syntax, much as IASTNode.getLeadingSyntax() or
|
// trailing syntax, much as IASTNode.getLeadingSyntax() or
|
||||||
// getTrailingSyntax() would. The code here follows the
|
// getTrailingSyntax() would. The code here follows the
|
||||||
// implementation of those functions closely.
|
// implementation of those functions closely.
|
||||||
ASTNodeSearch visitor = new ASTNodeSearch(relativeNode);
|
ASTNodeSearch visitor = new ASTNodeSearch(relativeNode);
|
||||||
IASTNode sibling = trailing ? visitor.findRightSibling() : visitor.findLeftSibling();
|
IASTNode sibling = trailing ? visitor.findRightSibling() : visitor.findLeftSibling();
|
||||||
IASTNode parent = sibling == null ? relativeNode.getParent() : null;
|
IASTNode parent = sibling == null ? relativeNode.getParent() : null;
|
||||||
if (!((sibling == null || sibling instanceof ASTNode) &&
|
if (!((sibling == null || sibling instanceof ASTNode) &&
|
||||||
(parent == null || parent instanceof ASTNode))) {
|
(parent == null || parent instanceof ASTNode))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ASTNode sib = (ASTNode) sibling;
|
ASTNode sib = (ASTNode) sibling;
|
||||||
ASTNode par = (ASTNode) parent;
|
ASTNode par = (ASTNode) parent;
|
||||||
int start = trailing ? relative.getOffset() + relative.getLength()
|
@SuppressWarnings("null")
|
||||||
|
int start = trailing ? relative.getOffset() + relative.getLength()
|
||||||
: sib != null ? sib.getOffset() + sib.getLength()
|
: sib != null ? sib.getOffset() + sib.getLength()
|
||||||
: par.getOffset();
|
: par.getOffset();
|
||||||
|
@SuppressWarnings("null")
|
||||||
int end = trailing ? sib != null ? sib.getOffset()
|
int end = trailing ? sib != null ? sib.getOffset()
|
||||||
: par.getOffset() + par.getLength()
|
: par.getOffset() + par.getLength()
|
||||||
: relative.getOffset();
|
: relative.getOffset();
|
||||||
|
|
||||||
// If there is only one token within the bounds, it must be the
|
// If there is only one token within the bounds, it must be the
|
||||||
// operator token, and we have our answer.
|
// operator token, and we have our answer.
|
||||||
if (end == start + 1) {
|
if (end == start + 1) {
|
||||||
setOffsetAndLength(start, 1);
|
setOffsetAndLength(start, 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, give up.
|
// Otherwise, give up.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue