1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-05 16:56:04 +02:00

Fixed compiler warnings.

Change-Id: I6617c9cf0564c8011da4f35f41cbae29c453adfa
This commit is contained in:
Sergey Prigogin 2016-06-17 18:18:50 -07:00 committed by Gerrit Code Review @ Eclipse.org
parent d6d135d701
commit 0937af705b
2 changed files with 20 additions and 15 deletions

View file

@ -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.IScope;
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;
/**
@ -29,14 +28,14 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.DestructorCallColl
*/
public class CPPASTForStatement extends CPPASTAttributeOwner implements ICPPASTForStatement {
private IScope fScope;
private IASTStatement fInit;
private IASTExpression fCondition;
private IASTDeclaration fCondDeclaration;
private IASTExpression fIterationExpression;
private IASTStatement fBody;
private IASTImplicitDestructorName[] fImplicitDestructorNames;
public CPPASTForStatement() {
}
@ -60,7 +59,7 @@ public class CPPASTForStatement extends CPPASTAttributeOwner implements ICPPASTF
public CPPASTForStatement copy() {
return copy(CopyStyle.withoutLocations);
}
@Override
public CPPASTForStatement copy(CopyStyle style) {
CPPASTForStatement copy = new CPPASTForStatement();
@ -164,7 +163,7 @@ public class CPPASTForStatement extends CPPASTAttributeOwner implements ICPPASTF
}
return true;
}
@Override
public void replace(IASTNode child, IASTNode other) {
if (fBody == child) {

View file

@ -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.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 {
private boolean alternate;
private boolean isOperator;
@ -89,7 +93,7 @@ public class CPPASTImplicitName extends CPPASTName implements IASTImplicitName {
public boolean isReference() {
return !isDefinition;
}
public void setIsDefinition(boolean val) {
isDefinition= val;
}
@ -128,7 +132,7 @@ public class CPPASTImplicitName extends CPPASTName implements IASTImplicitName {
}
}
}
// Fallback algorithm to use in computeOperatorOffsets() when the operator is
// in a macro expansion.
private boolean computeOperatorOffsetsFallback(IASTNode relativeNode, boolean trailing) {
@ -136,34 +140,36 @@ public class CPPASTImplicitName extends CPPASTName implements IASTImplicitName {
return false;
}
ASTNode relative = (ASTNode) relativeNode;
// Find the sequence numbers denoting the bounds of the leading or
// trailing syntax, much as IASTNode.getLeadingSyntax() or
// Find the sequence numbers denoting the bounds of the leading or
// trailing syntax, much as IASTNode.getLeadingSyntax() or
// getTrailingSyntax() would. The code here follows the
// implementation of those functions closely.
ASTNodeSearch visitor = new ASTNodeSearch(relativeNode);
IASTNode sibling = trailing ? visitor.findRightSibling() : visitor.findLeftSibling();
IASTNode parent = sibling == null ? relativeNode.getParent() : null;
if (!((sibling == null || sibling instanceof ASTNode) &&
if (!((sibling == null || sibling instanceof ASTNode) &&
(parent == null || parent instanceof ASTNode))) {
return false;
}
ASTNode sib = (ASTNode) sibling;
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()
: par.getOffset();
@SuppressWarnings("null")
int end = trailing ? sib != null ? sib.getOffset()
: par.getOffset() + par.getLength()
: relative.getOffset();
// If there is only one token within the bounds, it must be the
// operator token, and we have our answer.
if (end == start + 1) {
setOffsetAndLength(start, 1);
return true;
}
// Otherwise, give up.
return false;
}