mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 22:22:11 +02:00
Cosmetics.
This commit is contained in:
parent
48613495d7
commit
14bea54256
11 changed files with 93 additions and 157 deletions
|
@ -6,15 +6,14 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Alena Laskavaia - initial API and implementation
|
||||
* Tomasz Wesolowski - Bug 348387
|
||||
* Alena Laskavaia - initial API and implementation
|
||||
* Tomasz Wesolowski - Bug 348387
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.codan.core.cxx.internal.model.cfg;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.eclipse.cdt.codan.core.model.cfg.IBasicBlock;
|
||||
import org.eclipse.cdt.codan.core.model.cfg.IBranchNode;
|
||||
|
@ -67,30 +66,26 @@ public class ControlFlowGraphBuilder {
|
|||
CxxNodeFactory factory = new CxxNodeFactory();
|
||||
IConnectorNode outerBreak;
|
||||
IConnectorNode outerContinue;
|
||||
HashMap<String, IBasicBlock> labels = new HashMap<String, IBasicBlock>(0);
|
||||
HashMap<String, IBasicBlock> labels = new HashMap<>();
|
||||
|
||||
/**
|
||||
* @param def
|
||||
* @return
|
||||
* Builds the graph.
|
||||
*/
|
||||
public CxxControlFlowGraph build(IASTFunctionDefinition def) {
|
||||
IASTStatement body = def.getBody();
|
||||
start = new CxxStartNode();
|
||||
exits = new ArrayList<IExitNode>();
|
||||
dead = new ArrayList<IBasicBlock>();
|
||||
exits = new ArrayList<>();
|
||||
dead = new ArrayList<>();
|
||||
IBasicBlock last = createSubGraph(start, body);
|
||||
if (!(last instanceof IExitNode) && !deadConnector(last)) {
|
||||
returnExit = factory.createExitNode(null);
|
||||
returnExit.setStartNode(start);
|
||||
addOutgoing(last, returnExit);
|
||||
exits.add(returnExit);
|
||||
if (dead.size() > 0) {
|
||||
for (Iterator<IBasicBlock> iterator = dead.iterator(); iterator.hasNext();) {
|
||||
IBasicBlock ds = iterator.next();
|
||||
IBasicBlock dl = findLast(ds);
|
||||
if (dl != null && dl.getOutgoingSize() == 0 && dl != returnExit) {
|
||||
((AbstractBasicBlock) dl).addOutgoing(returnExit);
|
||||
}
|
||||
for (IBasicBlock ds : dead) {
|
||||
IBasicBlock dl = findLast(ds);
|
||||
if (dl != null && dl.getOutgoingSize() == 0 && dl != returnExit) {
|
||||
((AbstractBasicBlock) dl).addOutgoing(returnExit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -99,10 +94,6 @@ public class ControlFlowGraphBuilder {
|
|||
return graph;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param last
|
||||
* @return
|
||||
*/
|
||||
private boolean deadConnector(IBasicBlock conn) {
|
||||
if (conn instanceof IJumpNode || conn instanceof IConnectorNode) {
|
||||
if (conn.getIncomingSize() == 0) {
|
||||
|
@ -124,7 +115,7 @@ public class ControlFlowGraphBuilder {
|
|||
return false;
|
||||
}
|
||||
|
||||
public IBasicBlock findLast(IBasicBlock node) {
|
||||
private IBasicBlock findLast(IBasicBlock node) {
|
||||
if (node instanceof IJumpNode)
|
||||
return null;
|
||||
if (node.getOutgoingSize() == 0)
|
||||
|
@ -137,10 +128,6 @@ public class ControlFlowGraphBuilder {
|
|||
return node;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param start2
|
||||
* @param body
|
||||
*/
|
||||
private IBasicBlock createSubGraph(IBasicBlock prev, IASTNode body) {
|
||||
if (body instanceof IASTCompoundStatement) {
|
||||
IASTCompoundStatement comp = (IASTCompoundStatement) body;
|
||||
|
@ -223,11 +210,6 @@ public class ControlFlowGraphBuilder {
|
|||
return prev;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param prev
|
||||
* @param body
|
||||
* @return
|
||||
*/
|
||||
private IBasicBlock createTry(IBasicBlock prev, ICPPASTTryBlockStatement body) {
|
||||
DecisionNode ifNode = factory.createDecisionNode(body);
|
||||
addOutgoing(prev, ifNode);
|
||||
|
@ -254,10 +236,6 @@ public class ControlFlowGraphBuilder {
|
|||
return mergeNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param body
|
||||
* @return
|
||||
*/
|
||||
private boolean isThrowStatement(IASTNode body) {
|
||||
if (!(body instanceof IASTExpressionStatement))
|
||||
return false;
|
||||
|
@ -277,11 +255,6 @@ public class ControlFlowGraphBuilder {
|
|||
return functionNameExpression.getRawSignature().equals("exit"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/**
|
||||
* @param prev
|
||||
* @param body
|
||||
* @return
|
||||
*/
|
||||
protected CxxExitNode createExitNode(IBasicBlock prev, IASTNode body) {
|
||||
CxxExitNode node = factory.createExitNode(body);
|
||||
node.setStartNode(start);
|
||||
|
@ -290,11 +263,6 @@ public class ControlFlowGraphBuilder {
|
|||
return node;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param prev
|
||||
* @param labelName
|
||||
* @return
|
||||
*/
|
||||
protected IConnectorNode createLabelNodes(IBasicBlock prev, String labelName) {
|
||||
IBranchNode branch = factory.createBranchNode(labelName);
|
||||
if (prev != null)
|
||||
|
@ -305,11 +273,6 @@ public class ControlFlowGraphBuilder {
|
|||
return conn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param prev
|
||||
* @param body
|
||||
* @return
|
||||
*/
|
||||
protected IBasicBlock createIf(IBasicBlock prev, IASTIfStatement body) {
|
||||
DecisionNode ifNode = factory.createDecisionNode(body.getConditionExpression());
|
||||
addOutgoing(prev, ifNode);
|
||||
|
@ -326,11 +289,6 @@ public class ControlFlowGraphBuilder {
|
|||
return mergeNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param prev
|
||||
* @param body
|
||||
* @return
|
||||
*/
|
||||
private IBasicBlock createSwitch(IBasicBlock prev, IASTSwitchStatement body) {
|
||||
DecisionNode node = factory.createDecisionNode(body.getControllerExpression());
|
||||
addOutgoing(prev, node);
|
||||
|
@ -340,12 +298,6 @@ public class ControlFlowGraphBuilder {
|
|||
return conn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param switchNode
|
||||
* @param mergeNode
|
||||
* @param def
|
||||
* @param body
|
||||
*/
|
||||
private void createSwitchBody(DecisionNode switchNode, IConnectorNode mergeNode, IASTStatement body) {
|
||||
if (!(body instanceof IASTCompoundStatement))
|
||||
return; // bad
|
||||
|
@ -383,29 +335,24 @@ public class ControlFlowGraphBuilder {
|
|||
addJump(prev, mergeNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param prev
|
||||
* @param forNode
|
||||
* @return
|
||||
*/
|
||||
private IBasicBlock createFor(IBasicBlock prev, IASTForStatement forNode) {
|
||||
// add initializer
|
||||
// Add initializer
|
||||
IPlainNode init = factory.createPlainNode(forNode.getInitializerStatement());
|
||||
addOutgoing(prev, init);
|
||||
prev = init;
|
||||
// add continue connector
|
||||
// Add continue connector
|
||||
IConnectorNode beforeCheck = factory.createConnectorNode();
|
||||
addOutgoing(prev, beforeCheck);
|
||||
// decision node
|
||||
// Decision node
|
||||
CxxDecisionNode decision = factory.createDecisionNode(forNode.getConditionExpression());
|
||||
addOutgoing(beforeCheck, decision);
|
||||
// add break connector
|
||||
// Add break connector
|
||||
IConnectorNode nBreak = factory.createConnectorNode();
|
||||
decision.setMergeNode(nBreak);
|
||||
// create body and jump to continue node
|
||||
// Create body and jump to continue node
|
||||
IBranchNode loopStart = factory.createBranchNode(IBranchNode.THEN);
|
||||
addOutgoing(decision, loopStart);
|
||||
// set break/continue
|
||||
// Set break/continue
|
||||
IConnectorNode nContinue = factory.createConnectorNode();
|
||||
IConnectorNode savedContinue = outerContinue;
|
||||
IConnectorNode savedBreak = outerBreak;
|
||||
|
@ -418,45 +365,40 @@ public class ControlFlowGraphBuilder {
|
|||
IPlainNode inc = factory.createPlainNode(forNode.getIterationExpression());
|
||||
addOutgoing(endBody, nContinue);
|
||||
addOutgoing(nContinue, inc);
|
||||
// connect with backward link
|
||||
// Connect with backward link
|
||||
addJump(inc, beforeCheck, true);
|
||||
// add "else" branch
|
||||
// Add "else" branch
|
||||
IBranchNode loopEnd = factory.createBranchNode(IBranchNode.ELSE);
|
||||
addOutgoing(decision, loopEnd);
|
||||
addJump(loopEnd, nBreak);
|
||||
return nBreak;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param prev
|
||||
* @param body
|
||||
* @return
|
||||
*/
|
||||
protected IBasicBlock createWhile(IBasicBlock prev, IASTWhileStatement body) {
|
||||
// add continue connector
|
||||
// Add continue connector
|
||||
IConnectorNode nContinue = factory.createConnectorNode();
|
||||
addOutgoing(prev, nContinue);
|
||||
// decision node
|
||||
// Decision node
|
||||
CxxDecisionNode decision = factory.createDecisionNode(body.getCondition());
|
||||
addOutgoing(nContinue, decision);
|
||||
// add break connector
|
||||
// Add break connector
|
||||
IConnectorNode nBreak = factory.createConnectorNode();
|
||||
decision.setMergeNode(nBreak);
|
||||
// create body and jump to continue node
|
||||
// Create body and jump to continue node
|
||||
IBranchNode loopStart = factory.createBranchNode(IBranchNode.THEN);
|
||||
addOutgoing(decision, loopStart);
|
||||
// set break/continue
|
||||
// Set break/continue
|
||||
IConnectorNode savedContinue = outerContinue;
|
||||
IConnectorNode savedBreak = outerBreak;
|
||||
outerContinue = nContinue;
|
||||
outerBreak = nBreak;
|
||||
IBasicBlock endBody = createSubGraph(loopStart, body.getBody());
|
||||
// restore
|
||||
// Restore
|
||||
outerContinue = savedContinue;
|
||||
outerBreak = savedBreak;
|
||||
// backward jump
|
||||
// Backward jump
|
||||
addJump(endBody, nContinue, true);
|
||||
// connect with else branch
|
||||
// Connect with else branch
|
||||
IBranchNode loopEnd = factory.createBranchNode(IBranchNode.ELSE);
|
||||
addOutgoing(decision, loopEnd);
|
||||
addJump(loopEnd, nBreak);
|
||||
|
@ -464,7 +406,7 @@ public class ControlFlowGraphBuilder {
|
|||
}
|
||||
|
||||
protected IBasicBlock createDoWhile(IBasicBlock prev, IASTDoStatement body) {
|
||||
// create body and jump to continue node
|
||||
// Create body and jump to continue node
|
||||
IConnectorNode loopStart = factory.createConnectorNode();
|
||||
addOutgoing(prev, loopStart);
|
||||
// continue/break
|
||||
|
@ -475,12 +417,12 @@ public class ControlFlowGraphBuilder {
|
|||
outerContinue = nContinue;
|
||||
outerBreak = nBreak;
|
||||
IBasicBlock endBody = createSubGraph(loopStart, body.getBody());
|
||||
// restore
|
||||
// Restore
|
||||
outerContinue = savedContinue;
|
||||
outerBreak = savedBreak;
|
||||
// add continue connector
|
||||
// Add continue connector
|
||||
addOutgoing(endBody, nContinue);
|
||||
// decision node
|
||||
// Decision node
|
||||
CxxDecisionNode decision = factory.createDecisionNode(body.getCondition());
|
||||
addOutgoing(nContinue, decision);
|
||||
// then branch
|
||||
|
@ -489,12 +431,12 @@ public class ControlFlowGraphBuilder {
|
|||
IJumpNode jumpToStart = factory.createJumpNode();
|
||||
addOutgoing(thenNode, jumpToStart);
|
||||
((JumpNode) jumpToStart).setBackward(true);
|
||||
// connect with backward link
|
||||
// Connect with backward link
|
||||
addOutgoing(jumpToStart, loopStart);
|
||||
// connect with else branch
|
||||
// Connect with else branch
|
||||
IBranchNode loopEnd = factory.createBranchNode(IBranchNode.ELSE);
|
||||
addOutgoing(decision, loopEnd);
|
||||
// add break connector
|
||||
// Add break connector
|
||||
decision.setMergeNode(nBreak);
|
||||
addJump(loopEnd, nBreak);
|
||||
return nBreak;
|
||||
|
@ -516,10 +458,6 @@ public class ControlFlowGraphBuilder {
|
|||
return jump;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param prev
|
||||
* @param node
|
||||
*/
|
||||
private void addOutgoing(IBasicBlock prev, IBasicBlock node) {
|
||||
if (prev instanceof IExitNode || prev == null) {
|
||||
dead.add(node);
|
||||
|
|
|
@ -16,7 +16,6 @@ import org.eclipse.cdt.codan.core.model.cfg.IStartNode;
|
|||
|
||||
/**
|
||||
* Plain node has one prev one jump
|
||||
*
|
||||
*/
|
||||
public class ExitNode extends AbstractSingleIncomingNode implements IExitNode {
|
||||
private IStartNode start;
|
||||
|
|
|
@ -19,83 +19,83 @@ package org.eclipse.cdt.core.dom.ast;
|
|||
public interface IASTUnaryExpression extends IASTExpression {
|
||||
/**
|
||||
* Prefix increment.
|
||||
* <code>op_prefixIncr</code> ++exp
|
||||
* {@code op_prefixIncr}: ++exp
|
||||
*/
|
||||
public static final int op_prefixIncr = 0;
|
||||
|
||||
/**
|
||||
* Prefix decrement.
|
||||
* <code>op_prefixDecr</code> --exp
|
||||
* {@code op_prefixDecr}: --exp
|
||||
*/
|
||||
public static final int op_prefixDecr = 1;
|
||||
|
||||
/**
|
||||
* Operator plus.
|
||||
* <code>op_plus</code> ==> +exp
|
||||
* {@code op_plus}: +exp
|
||||
*/
|
||||
public static final int op_plus = 2;
|
||||
|
||||
/**
|
||||
* Operator minus.
|
||||
* <code>op_minux</code> ==> -exp
|
||||
* {@code op_minux}: -exp
|
||||
*/
|
||||
public static final int op_minus = 3;
|
||||
|
||||
/**
|
||||
* Operator star.
|
||||
* <code>op_star</code> ==> *exp
|
||||
* {@code op_star}: *exp
|
||||
*/
|
||||
public static final int op_star = 4;
|
||||
|
||||
/**
|
||||
* Operator ampersand.
|
||||
* <code>op_amper</code> ==> &exp
|
||||
* {@code op_amper}: &exp
|
||||
*/
|
||||
public static final int op_amper = 5;
|
||||
|
||||
/**
|
||||
* Operator tilde.
|
||||
* <code>op_tilde</code> ==> ~exp
|
||||
* {@code op_tilde}: ~exp
|
||||
*/
|
||||
public static final int op_tilde = 6;
|
||||
|
||||
/**
|
||||
* not.
|
||||
* <code>op_not</code> ==> ! exp
|
||||
* {@code op_not}: !exp
|
||||
*/
|
||||
public static final int op_not = 7;
|
||||
|
||||
/**
|
||||
* sizeof.
|
||||
* <code>op_sizeof</code> ==> sizeof exp
|
||||
* {@code op_sizeof}: sizeof exp
|
||||
*/
|
||||
public static final int op_sizeof = 8;
|
||||
|
||||
/**
|
||||
* Postfix increment.
|
||||
* <code>op_postFixIncr</code> ==> exp++
|
||||
* {@code op_postFixIncr}: exp++
|
||||
*/
|
||||
public static final int op_postFixIncr = 9;
|
||||
|
||||
/**
|
||||
* Postfix decrement.
|
||||
* <code>op_bracketedPrimary</code> ==> exp--
|
||||
* {@code op_postFixDecr}: exp--
|
||||
*/
|
||||
public static final int op_postFixDecr = 10;
|
||||
|
||||
/**
|
||||
* A bracketed expression.
|
||||
* <code>op_bracketedPrimary</code> ==> ( exp )
|
||||
* {@code op_bracketedPrimary}: ( exp )
|
||||
*/
|
||||
public static final int op_bracketedPrimary = 11;
|
||||
|
||||
/**
|
||||
* for c++, only. <code>op_throw</code> throw exp
|
||||
* For C++, only. {@code op_throw}: throw exp
|
||||
*/
|
||||
public static final int op_throw = 12;
|
||||
|
||||
/**
|
||||
* for c++, only. <code>op_typeid</code> = typeid( exp )
|
||||
* For C++, only. {@code op_typeid}: typeid( exp )
|
||||
*/
|
||||
public static final int op_typeid = 13;
|
||||
|
||||
|
@ -106,62 +106,63 @@ public interface IASTUnaryExpression extends IASTExpression {
|
|||
public static final int op_typeof = 14;
|
||||
|
||||
/**
|
||||
* For gnu parsers, only. <code>op_alignOf</code> is used for __alignOf( unaryExpression ) type
|
||||
* For GCC parsers, only. {@code op_alignOf} is used for __alignOf( unaryExpression ) type
|
||||
* expressions.
|
||||
*/
|
||||
public static final int op_alignOf = 15;
|
||||
|
||||
/**
|
||||
* For c++, only: 'sizeof... ( parameterPack )'
|
||||
* For C++, only: 'sizeof... ( parameterPack )'
|
||||
* @since 5.2
|
||||
*/
|
||||
public static final int op_sizeofParameterPack = 16;
|
||||
|
||||
/**
|
||||
* For c++, only: noexcept ( expression )
|
||||
* For C++, only: noexcept ( expression )
|
||||
* @since 5.5
|
||||
*/
|
||||
public static final int op_noexcept = 17;
|
||||
|
||||
/**
|
||||
* <code>op_last</code> is made available for subclasses.
|
||||
* {@code op_last} is made available for subclasses.
|
||||
* @deprecated all constants must be defined in this interface
|
||||
*/
|
||||
@Deprecated
|
||||
public static final int op_last = op_alignOf;
|
||||
|
||||
/**
|
||||
* Get the operator/kind.
|
||||
*
|
||||
* @return (int)
|
||||
*/
|
||||
public int getOperator();
|
||||
|
||||
/**
|
||||
* Set the operator/kind.
|
||||
*
|
||||
* @param value (int) value
|
||||
*/
|
||||
public void setOperator(int value);
|
||||
|
||||
/**
|
||||
* <code>OPERAND</code> represents the relationship between an <code>IASTUnaryExpression</code> and
|
||||
* it's nested <code>IASTExpression</code>.
|
||||
* {@code OPERAND} represents the relationship between an {@code IASTUnaryExpression} and
|
||||
* it's nested {@code IASTExpression}.
|
||||
*/
|
||||
public static final ASTNodeProperty OPERAND =
|
||||
new ASTNodeProperty("IASTUnaryExpression.OPERAND - IASTExpression (operand) for IASTUnaryExpression"); //$NON-NLS-1$
|
||||
|
||||
|
||||
/**
|
||||
* Get the operand.
|
||||
* Returns the operator/kind.
|
||||
*
|
||||
* @return <code>IASTExpression</code>
|
||||
* @return the operator, one of {@code op_*} constants defined in this interface.
|
||||
*/
|
||||
public int getOperator();
|
||||
|
||||
/**
|
||||
* Sets the operator/kind.
|
||||
*
|
||||
* @param operator the operator, one of {@code op_*} constants defined in this interface.
|
||||
*/
|
||||
public void setOperator(int operator);
|
||||
|
||||
/**
|
||||
* Returns the operand.
|
||||
*
|
||||
* @return {@code IASTExpression}
|
||||
*/
|
||||
public IASTExpression getOperand();
|
||||
|
||||
/**
|
||||
* Set the operand.
|
||||
* Sets the operand.
|
||||
*
|
||||
* @param expression <code>IASTExpression</code>
|
||||
* @param expression {@code IASTExpression}
|
||||
*/
|
||||
public void setOperand(IASTExpression expression);
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - Initial API and implementation
|
||||
* Markus Schorn - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser;
|
||||
|
||||
|
@ -25,7 +25,6 @@ import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
|||
* It also handles the impact on the grouping of the sub-expressions.
|
||||
*/
|
||||
public abstract class ASTAmbiguousBinaryVsCastExpression extends ASTAmbiguousNode implements IASTAmbiguousExpression {
|
||||
|
||||
private final IASTBinaryExpression fBinaryExpression;
|
||||
private final IASTCastExpression fCastExpression;
|
||||
|
||||
|
@ -113,7 +112,7 @@ public abstract class ASTAmbiguousBinaryVsCastExpression extends ASTAmbiguousNod
|
|||
if (primaryInParenthesis != null && leadingCastExpression != null && castedUnary instanceof IASTUnaryExpression) {
|
||||
IASTExpression lp= (IASTExpression) primaryInParenthesis.getParent();
|
||||
IASTBinaryExpression rp= (IASTBinaryExpression) leadingCastExpression.getParent();
|
||||
((IASTUnaryExpression)castedUnary).setOperand(leadingCastExpression);
|
||||
((IASTUnaryExpression) castedUnary).setOperand(leadingCastExpression);
|
||||
setEnd(castedUnary, leadingCastExpression);
|
||||
setRange(fCastExpression, primaryInParenthesis, leadingCastExpression);
|
||||
IASTExpression root= joinExpressions(lp, fCastExpression, rp);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - Initial API and implementation
|
||||
* Markus Schorn - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser;
|
||||
|
||||
|
@ -29,7 +29,6 @@ import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
|||
* It also handles the impact on the grouping of the sub-expressions.
|
||||
*/
|
||||
public abstract class ASTAmbiguousCastVsFunctionCallExpression extends ASTAmbiguousNode implements IASTAmbiguousExpression {
|
||||
|
||||
private final IASTCastExpression fCastExpression;
|
||||
private final IASTFunctionCallExpression fFunctionCallExpression;
|
||||
|
||||
|
@ -158,7 +157,7 @@ public abstract class ASTAmbiguousCastVsFunctionCallExpression extends ASTAmbigu
|
|||
}
|
||||
|
||||
owner.replace(nodeToReplace, result);
|
||||
// resolve ambiguities in the function-call expression
|
||||
// Resolve ambiguities in the function-call expression
|
||||
fFunctionCallExpression.getFunctionNameExpression().accept(visitor);
|
||||
return result;
|
||||
}
|
||||
|
@ -177,8 +176,7 @@ public abstract class ASTAmbiguousCastVsFunctionCallExpression extends ASTAmbigu
|
|||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (operand instanceof IASTArraySubscriptExpression) {
|
||||
} else if (operand instanceof IASTArraySubscriptExpression) {
|
||||
operand= ((IASTArraySubscriptExpression) operand).getArrayExpression();
|
||||
} else if (operand instanceof IASTFunctionCallExpression) {
|
||||
operand= ((IASTFunctionCallExpression) operand).getFunctionNameExpression();
|
||||
|
|
|
@ -1114,13 +1114,13 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
|||
* swallow this one.
|
||||
*/
|
||||
if (e instanceof CoreException) {
|
||||
s=((CoreException) e).getStatus();
|
||||
s= ((CoreException) e).getStatus();
|
||||
if (s.getCode() == CCorePlugin.STATUS_PDOM_TOO_LARGE) {
|
||||
if (CCorePlugin.PLUGIN_ID.equals(s.getPlugin()))
|
||||
throw (CoreException) e;
|
||||
}
|
||||
|
||||
// mask errors in order to avoid dialog from platform
|
||||
// Mask errors in order to avoid dialog from platform
|
||||
Throwable exception = s.getException();
|
||||
if (exception != null) {
|
||||
Throwable masked= getMaskedException(exception);
|
||||
|
|
|
@ -116,9 +116,8 @@ public class CSearchLabelProvider extends LabelProvider implements IStyledLabelP
|
|||
}
|
||||
|
||||
if (element instanceof TypeInfoSearchElement) {
|
||||
return fTypeInfoLabelProvider.getText(((TypeInfoSearchElement)element).getTypeInfo());
|
||||
}
|
||||
else if (element instanceof ProblemSearchElement) {
|
||||
return fTypeInfoLabelProvider.getText(((TypeInfoSearchElement) element).getTypeInfo());
|
||||
} else if (element instanceof ProblemSearchElement) {
|
||||
ProblemSearchElement pse= (ProblemSearchElement) element;
|
||||
return ASTProblem.getMessage(pse.getProblemID(), pse.getDetail());
|
||||
}
|
||||
|
@ -128,7 +127,7 @@ public class CSearchLabelProvider extends LabelProvider implements IStyledLabelP
|
|||
}
|
||||
|
||||
if (element instanceof IIndexFileLocation) {
|
||||
IPath path= IndexLocationFactory.getPath((IIndexFileLocation)element);
|
||||
IPath path= IndexLocationFactory.getPath((IIndexFileLocation) element);
|
||||
if (path != null) {
|
||||
// these are categorized into directories already
|
||||
return path.lastSegment();
|
||||
|
|
|
@ -70,7 +70,7 @@ public class CSearchListContentProvider implements IStructuredContentProvider, I
|
|||
}
|
||||
|
||||
// add message for all the projects which have no results
|
||||
ICProject[] projects = ((CSearchQuery)result.getQuery()).getProjects();
|
||||
ICProject[] projects = ((CSearchQuery) result.getQuery()).getProjects();
|
||||
for (int i = 0; i < projects.length; ++i) {
|
||||
ICProject project = projects[i];
|
||||
boolean foundProject = uncoveredProjects.contains(project.getProject().getName());
|
||||
|
|
|
@ -26,7 +26,7 @@ public class CSearchMatch extends Match {
|
|||
}
|
||||
|
||||
IIndexFileLocation getLocation() {
|
||||
return ((CSearchElement)getElement()).getLocation();
|
||||
return ((CSearchElement) getElement()).getLocation();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -35,10 +35,10 @@ public class CSearchMatch extends Match {
|
|||
return true;
|
||||
if (!(obj instanceof CSearchMatch))
|
||||
return false;
|
||||
CSearchMatch other = (CSearchMatch)obj;
|
||||
CSearchMatch other = (CSearchMatch) obj;
|
||||
return getElement().equals(other.getElement())
|
||||
&& getOffset() == other.getOffset()
|
||||
&& getLength() == other.getLength();
|
||||
&& getOffset() == other.getOffset()
|
||||
&& getLength() == other.getLength();
|
||||
}
|
||||
|
||||
public void setIsPolymorphicCall() {
|
||||
|
|
|
@ -159,7 +159,7 @@ public class CSearchPage extends DialogPage implements ISearchPage {
|
|||
|
||||
private ICElement getElement(Object obj) {
|
||||
if (obj instanceof IResource) {
|
||||
return CoreModel.getDefault().create((IResource)obj);
|
||||
return CoreModel.getDefault().create((IResource) obj);
|
||||
}
|
||||
if (obj instanceof ICElement) {
|
||||
ICElement elem= (ICElement) obj;
|
||||
|
@ -190,7 +190,7 @@ public class CSearchPage extends DialogPage implements ISearchPage {
|
|||
} else {
|
||||
for (int i = 0; i < searchForButtons.length; ++i) {
|
||||
if (searchForButtons[i].getSelection())
|
||||
searchFlags |= ((Integer)searchForButtons[i].getData()).intValue();
|
||||
searchFlags |= ((Integer) searchForButtons[i].getData()).intValue();
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < limitToButtons.length; ++i) {
|
||||
|
|
|
@ -158,7 +158,9 @@ public class CSearchResult extends AbstractTextSearchResult implements IEditorMa
|
|||
if (location.getFullPath() != null) {
|
||||
return ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(location.getFullPath()));
|
||||
}
|
||||
} catch(CoreException ce) { /* fall-through to return null */ }
|
||||
} catch (CoreException e) {
|
||||
// Fall-through to return null.
|
||||
}
|
||||
} else if (element instanceof CSearchElement) {
|
||||
CSearchElement searchElement = (CSearchElement) element;
|
||||
IIndexFileLocation location = searchElement.getLocation();
|
||||
|
|
Loading…
Add table
Reference in a new issue