1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-06 17:26:01 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2014-03-28 09:11:46 -07:00
parent 48613495d7
commit 14bea54256
11 changed files with 93 additions and 157 deletions

View file

@ -14,7 +14,6 @@ package org.eclipse.cdt.codan.core.cxx.internal.model.cfg;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; 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.IBasicBlock;
import org.eclipse.cdt.codan.core.model.cfg.IBranchNode; import org.eclipse.cdt.codan.core.model.cfg.IBranchNode;
@ -67,42 +66,34 @@ public class ControlFlowGraphBuilder {
CxxNodeFactory factory = new CxxNodeFactory(); CxxNodeFactory factory = new CxxNodeFactory();
IConnectorNode outerBreak; IConnectorNode outerBreak;
IConnectorNode outerContinue; IConnectorNode outerContinue;
HashMap<String, IBasicBlock> labels = new HashMap<String, IBasicBlock>(0); HashMap<String, IBasicBlock> labels = new HashMap<>();
/** /**
* @param def * Builds the graph.
* @return
*/ */
public CxxControlFlowGraph build(IASTFunctionDefinition def) { public CxxControlFlowGraph build(IASTFunctionDefinition def) {
IASTStatement body = def.getBody(); IASTStatement body = def.getBody();
start = new CxxStartNode(); start = new CxxStartNode();
exits = new ArrayList<IExitNode>(); exits = new ArrayList<>();
dead = new ArrayList<IBasicBlock>(); dead = new ArrayList<>();
IBasicBlock last = createSubGraph(start, body); IBasicBlock last = createSubGraph(start, body);
if (!(last instanceof IExitNode) && !deadConnector(last)) { if (!(last instanceof IExitNode) && !deadConnector(last)) {
returnExit = factory.createExitNode(null); returnExit = factory.createExitNode(null);
returnExit.setStartNode(start); returnExit.setStartNode(start);
addOutgoing(last, returnExit); addOutgoing(last, returnExit);
exits.add(returnExit); exits.add(returnExit);
if (dead.size() > 0) { for (IBasicBlock ds : dead) {
for (Iterator<IBasicBlock> iterator = dead.iterator(); iterator.hasNext();) {
IBasicBlock ds = iterator.next();
IBasicBlock dl = findLast(ds); IBasicBlock dl = findLast(ds);
if (dl != null && dl.getOutgoingSize() == 0 && dl != returnExit) { if (dl != null && dl.getOutgoingSize() == 0 && dl != returnExit) {
((AbstractBasicBlock) dl).addOutgoing(returnExit); ((AbstractBasicBlock) dl).addOutgoing(returnExit);
} }
} }
} }
}
CxxControlFlowGraph graph = new CxxControlFlowGraph(start, exits); CxxControlFlowGraph graph = new CxxControlFlowGraph(start, exits);
graph.setUnconnectedNodes(dead); graph.setUnconnectedNodes(dead);
return graph; return graph;
} }
/**
* @param last
* @return
*/
private boolean deadConnector(IBasicBlock conn) { private boolean deadConnector(IBasicBlock conn) {
if (conn instanceof IJumpNode || conn instanceof IConnectorNode) { if (conn instanceof IJumpNode || conn instanceof IConnectorNode) {
if (conn.getIncomingSize() == 0) { if (conn.getIncomingSize() == 0) {
@ -124,7 +115,7 @@ public class ControlFlowGraphBuilder {
return false; return false;
} }
public IBasicBlock findLast(IBasicBlock node) { private IBasicBlock findLast(IBasicBlock node) {
if (node instanceof IJumpNode) if (node instanceof IJumpNode)
return null; return null;
if (node.getOutgoingSize() == 0) if (node.getOutgoingSize() == 0)
@ -137,10 +128,6 @@ public class ControlFlowGraphBuilder {
return node; return node;
} }
/**
* @param start2
* @param body
*/
private IBasicBlock createSubGraph(IBasicBlock prev, IASTNode body) { private IBasicBlock createSubGraph(IBasicBlock prev, IASTNode body) {
if (body instanceof IASTCompoundStatement) { if (body instanceof IASTCompoundStatement) {
IASTCompoundStatement comp = (IASTCompoundStatement) body; IASTCompoundStatement comp = (IASTCompoundStatement) body;
@ -223,11 +210,6 @@ public class ControlFlowGraphBuilder {
return prev; return prev;
} }
/**
* @param prev
* @param body
* @return
*/
private IBasicBlock createTry(IBasicBlock prev, ICPPASTTryBlockStatement body) { private IBasicBlock createTry(IBasicBlock prev, ICPPASTTryBlockStatement body) {
DecisionNode ifNode = factory.createDecisionNode(body); DecisionNode ifNode = factory.createDecisionNode(body);
addOutgoing(prev, ifNode); addOutgoing(prev, ifNode);
@ -254,10 +236,6 @@ public class ControlFlowGraphBuilder {
return mergeNode; return mergeNode;
} }
/**
* @param body
* @return
*/
private boolean isThrowStatement(IASTNode body) { private boolean isThrowStatement(IASTNode body) {
if (!(body instanceof IASTExpressionStatement)) if (!(body instanceof IASTExpressionStatement))
return false; return false;
@ -277,11 +255,6 @@ public class ControlFlowGraphBuilder {
return functionNameExpression.getRawSignature().equals("exit"); //$NON-NLS-1$ return functionNameExpression.getRawSignature().equals("exit"); //$NON-NLS-1$
} }
/**
* @param prev
* @param body
* @return
*/
protected CxxExitNode createExitNode(IBasicBlock prev, IASTNode body) { protected CxxExitNode createExitNode(IBasicBlock prev, IASTNode body) {
CxxExitNode node = factory.createExitNode(body); CxxExitNode node = factory.createExitNode(body);
node.setStartNode(start); node.setStartNode(start);
@ -290,11 +263,6 @@ public class ControlFlowGraphBuilder {
return node; return node;
} }
/**
* @param prev
* @param labelName
* @return
*/
protected IConnectorNode createLabelNodes(IBasicBlock prev, String labelName) { protected IConnectorNode createLabelNodes(IBasicBlock prev, String labelName) {
IBranchNode branch = factory.createBranchNode(labelName); IBranchNode branch = factory.createBranchNode(labelName);
if (prev != null) if (prev != null)
@ -305,11 +273,6 @@ public class ControlFlowGraphBuilder {
return conn; return conn;
} }
/**
* @param prev
* @param body
* @return
*/
protected IBasicBlock createIf(IBasicBlock prev, IASTIfStatement body) { protected IBasicBlock createIf(IBasicBlock prev, IASTIfStatement body) {
DecisionNode ifNode = factory.createDecisionNode(body.getConditionExpression()); DecisionNode ifNode = factory.createDecisionNode(body.getConditionExpression());
addOutgoing(prev, ifNode); addOutgoing(prev, ifNode);
@ -326,11 +289,6 @@ public class ControlFlowGraphBuilder {
return mergeNode; return mergeNode;
} }
/**
* @param prev
* @param body
* @return
*/
private IBasicBlock createSwitch(IBasicBlock prev, IASTSwitchStatement body) { private IBasicBlock createSwitch(IBasicBlock prev, IASTSwitchStatement body) {
DecisionNode node = factory.createDecisionNode(body.getControllerExpression()); DecisionNode node = factory.createDecisionNode(body.getControllerExpression());
addOutgoing(prev, node); addOutgoing(prev, node);
@ -340,12 +298,6 @@ public class ControlFlowGraphBuilder {
return conn; return conn;
} }
/**
* @param switchNode
* @param mergeNode
* @param def
* @param body
*/
private void createSwitchBody(DecisionNode switchNode, IConnectorNode mergeNode, IASTStatement body) { private void createSwitchBody(DecisionNode switchNode, IConnectorNode mergeNode, IASTStatement body) {
if (!(body instanceof IASTCompoundStatement)) if (!(body instanceof IASTCompoundStatement))
return; // bad return; // bad
@ -383,29 +335,24 @@ public class ControlFlowGraphBuilder {
addJump(prev, mergeNode); addJump(prev, mergeNode);
} }
/**
* @param prev
* @param forNode
* @return
*/
private IBasicBlock createFor(IBasicBlock prev, IASTForStatement forNode) { private IBasicBlock createFor(IBasicBlock prev, IASTForStatement forNode) {
// add initializer // Add initializer
IPlainNode init = factory.createPlainNode(forNode.getInitializerStatement()); IPlainNode init = factory.createPlainNode(forNode.getInitializerStatement());
addOutgoing(prev, init); addOutgoing(prev, init);
prev = init; prev = init;
// add continue connector // Add continue connector
IConnectorNode beforeCheck = factory.createConnectorNode(); IConnectorNode beforeCheck = factory.createConnectorNode();
addOutgoing(prev, beforeCheck); addOutgoing(prev, beforeCheck);
// decision node // Decision node
CxxDecisionNode decision = factory.createDecisionNode(forNode.getConditionExpression()); CxxDecisionNode decision = factory.createDecisionNode(forNode.getConditionExpression());
addOutgoing(beforeCheck, decision); addOutgoing(beforeCheck, decision);
// add break connector // Add break connector
IConnectorNode nBreak = factory.createConnectorNode(); IConnectorNode nBreak = factory.createConnectorNode();
decision.setMergeNode(nBreak); decision.setMergeNode(nBreak);
// create body and jump to continue node // Create body and jump to continue node
IBranchNode loopStart = factory.createBranchNode(IBranchNode.THEN); IBranchNode loopStart = factory.createBranchNode(IBranchNode.THEN);
addOutgoing(decision, loopStart); addOutgoing(decision, loopStart);
// set break/continue // Set break/continue
IConnectorNode nContinue = factory.createConnectorNode(); IConnectorNode nContinue = factory.createConnectorNode();
IConnectorNode savedContinue = outerContinue; IConnectorNode savedContinue = outerContinue;
IConnectorNode savedBreak = outerBreak; IConnectorNode savedBreak = outerBreak;
@ -418,45 +365,40 @@ public class ControlFlowGraphBuilder {
IPlainNode inc = factory.createPlainNode(forNode.getIterationExpression()); IPlainNode inc = factory.createPlainNode(forNode.getIterationExpression());
addOutgoing(endBody, nContinue); addOutgoing(endBody, nContinue);
addOutgoing(nContinue, inc); addOutgoing(nContinue, inc);
// connect with backward link // Connect with backward link
addJump(inc, beforeCheck, true); addJump(inc, beforeCheck, true);
// add "else" branch // Add "else" branch
IBranchNode loopEnd = factory.createBranchNode(IBranchNode.ELSE); IBranchNode loopEnd = factory.createBranchNode(IBranchNode.ELSE);
addOutgoing(decision, loopEnd); addOutgoing(decision, loopEnd);
addJump(loopEnd, nBreak); addJump(loopEnd, nBreak);
return nBreak; return nBreak;
} }
/**
* @param prev
* @param body
* @return
*/
protected IBasicBlock createWhile(IBasicBlock prev, IASTWhileStatement body) { protected IBasicBlock createWhile(IBasicBlock prev, IASTWhileStatement body) {
// add continue connector // Add continue connector
IConnectorNode nContinue = factory.createConnectorNode(); IConnectorNode nContinue = factory.createConnectorNode();
addOutgoing(prev, nContinue); addOutgoing(prev, nContinue);
// decision node // Decision node
CxxDecisionNode decision = factory.createDecisionNode(body.getCondition()); CxxDecisionNode decision = factory.createDecisionNode(body.getCondition());
addOutgoing(nContinue, decision); addOutgoing(nContinue, decision);
// add break connector // Add break connector
IConnectorNode nBreak = factory.createConnectorNode(); IConnectorNode nBreak = factory.createConnectorNode();
decision.setMergeNode(nBreak); decision.setMergeNode(nBreak);
// create body and jump to continue node // Create body and jump to continue node
IBranchNode loopStart = factory.createBranchNode(IBranchNode.THEN); IBranchNode loopStart = factory.createBranchNode(IBranchNode.THEN);
addOutgoing(decision, loopStart); addOutgoing(decision, loopStart);
// set break/continue // Set break/continue
IConnectorNode savedContinue = outerContinue; IConnectorNode savedContinue = outerContinue;
IConnectorNode savedBreak = outerBreak; IConnectorNode savedBreak = outerBreak;
outerContinue = nContinue; outerContinue = nContinue;
outerBreak = nBreak; outerBreak = nBreak;
IBasicBlock endBody = createSubGraph(loopStart, body.getBody()); IBasicBlock endBody = createSubGraph(loopStart, body.getBody());
// restore // Restore
outerContinue = savedContinue; outerContinue = savedContinue;
outerBreak = savedBreak; outerBreak = savedBreak;
// backward jump // Backward jump
addJump(endBody, nContinue, true); addJump(endBody, nContinue, true);
// connect with else branch // Connect with else branch
IBranchNode loopEnd = factory.createBranchNode(IBranchNode.ELSE); IBranchNode loopEnd = factory.createBranchNode(IBranchNode.ELSE);
addOutgoing(decision, loopEnd); addOutgoing(decision, loopEnd);
addJump(loopEnd, nBreak); addJump(loopEnd, nBreak);
@ -464,7 +406,7 @@ public class ControlFlowGraphBuilder {
} }
protected IBasicBlock createDoWhile(IBasicBlock prev, IASTDoStatement body) { 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(); IConnectorNode loopStart = factory.createConnectorNode();
addOutgoing(prev, loopStart); addOutgoing(prev, loopStart);
// continue/break // continue/break
@ -475,12 +417,12 @@ public class ControlFlowGraphBuilder {
outerContinue = nContinue; outerContinue = nContinue;
outerBreak = nBreak; outerBreak = nBreak;
IBasicBlock endBody = createSubGraph(loopStart, body.getBody()); IBasicBlock endBody = createSubGraph(loopStart, body.getBody());
// restore // Restore
outerContinue = savedContinue; outerContinue = savedContinue;
outerBreak = savedBreak; outerBreak = savedBreak;
// add continue connector // Add continue connector
addOutgoing(endBody, nContinue); addOutgoing(endBody, nContinue);
// decision node // Decision node
CxxDecisionNode decision = factory.createDecisionNode(body.getCondition()); CxxDecisionNode decision = factory.createDecisionNode(body.getCondition());
addOutgoing(nContinue, decision); addOutgoing(nContinue, decision);
// then branch // then branch
@ -489,12 +431,12 @@ public class ControlFlowGraphBuilder {
IJumpNode jumpToStart = factory.createJumpNode(); IJumpNode jumpToStart = factory.createJumpNode();
addOutgoing(thenNode, jumpToStart); addOutgoing(thenNode, jumpToStart);
((JumpNode) jumpToStart).setBackward(true); ((JumpNode) jumpToStart).setBackward(true);
// connect with backward link // Connect with backward link
addOutgoing(jumpToStart, loopStart); addOutgoing(jumpToStart, loopStart);
// connect with else branch // Connect with else branch
IBranchNode loopEnd = factory.createBranchNode(IBranchNode.ELSE); IBranchNode loopEnd = factory.createBranchNode(IBranchNode.ELSE);
addOutgoing(decision, loopEnd); addOutgoing(decision, loopEnd);
// add break connector // Add break connector
decision.setMergeNode(nBreak); decision.setMergeNode(nBreak);
addJump(loopEnd, nBreak); addJump(loopEnd, nBreak);
return nBreak; return nBreak;
@ -516,10 +458,6 @@ public class ControlFlowGraphBuilder {
return jump; return jump;
} }
/**
* @param prev
* @param node
*/
private void addOutgoing(IBasicBlock prev, IBasicBlock node) { private void addOutgoing(IBasicBlock prev, IBasicBlock node) {
if (prev instanceof IExitNode || prev == null) { if (prev instanceof IExitNode || prev == null) {
dead.add(node); dead.add(node);

View file

@ -16,7 +16,6 @@ import org.eclipse.cdt.codan.core.model.cfg.IStartNode;
/** /**
* Plain node has one prev one jump * Plain node has one prev one jump
*
*/ */
public class ExitNode extends AbstractSingleIncomingNode implements IExitNode { public class ExitNode extends AbstractSingleIncomingNode implements IExitNode {
private IStartNode start; private IStartNode start;

View file

@ -19,83 +19,83 @@ package org.eclipse.cdt.core.dom.ast;
public interface IASTUnaryExpression extends IASTExpression { public interface IASTUnaryExpression extends IASTExpression {
/** /**
* Prefix increment. * Prefix increment.
* <code>op_prefixIncr</code> ++exp * {@code op_prefixIncr}: ++exp
*/ */
public static final int op_prefixIncr = 0; public static final int op_prefixIncr = 0;
/** /**
* Prefix decrement. * Prefix decrement.
* <code>op_prefixDecr</code> --exp * {@code op_prefixDecr}: --exp
*/ */
public static final int op_prefixDecr = 1; public static final int op_prefixDecr = 1;
/** /**
* Operator plus. * Operator plus.
* <code>op_plus</code> ==> +exp * {@code op_plus}: +exp
*/ */
public static final int op_plus = 2; public static final int op_plus = 2;
/** /**
* Operator minus. * Operator minus.
* <code>op_minux</code> ==> -exp * {@code op_minux}: -exp
*/ */
public static final int op_minus = 3; public static final int op_minus = 3;
/** /**
* Operator star. * Operator star.
* <code>op_star</code> ==> *exp * {@code op_star}: *exp
*/ */
public static final int op_star = 4; public static final int op_star = 4;
/** /**
* Operator ampersand. * Operator ampersand.
* <code>op_amper</code> ==> &exp * {@code op_amper}: &exp
*/ */
public static final int op_amper = 5; public static final int op_amper = 5;
/** /**
* Operator tilde. * Operator tilde.
* <code>op_tilde</code> ==> ~exp * {@code op_tilde}: ~exp
*/ */
public static final int op_tilde = 6; public static final int op_tilde = 6;
/** /**
* not. * not.
* <code>op_not</code> ==> ! exp * {@code op_not}: !exp
*/ */
public static final int op_not = 7; public static final int op_not = 7;
/** /**
* sizeof. * sizeof.
* <code>op_sizeof</code> ==> sizeof exp * {@code op_sizeof}: sizeof exp
*/ */
public static final int op_sizeof = 8; public static final int op_sizeof = 8;
/** /**
* Postfix increment. * Postfix increment.
* <code>op_postFixIncr</code> ==> exp++ * {@code op_postFixIncr}: exp++
*/ */
public static final int op_postFixIncr = 9; public static final int op_postFixIncr = 9;
/** /**
* Postfix decrement. * Postfix decrement.
* <code>op_bracketedPrimary</code> ==> exp-- * {@code op_postFixDecr}: exp--
*/ */
public static final int op_postFixDecr = 10; public static final int op_postFixDecr = 10;
/** /**
* A bracketed expression. * A bracketed expression.
* <code>op_bracketedPrimary</code> ==> ( exp ) * {@code op_bracketedPrimary}: ( exp )
*/ */
public static final int op_bracketedPrimary = 11; 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; 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; public static final int op_typeid = 13;
@ -106,62 +106,63 @@ public interface IASTUnaryExpression extends IASTExpression {
public static final int op_typeof = 14; 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. * expressions.
*/ */
public static final int op_alignOf = 15; public static final int op_alignOf = 15;
/** /**
* For c++, only: 'sizeof... ( parameterPack )' * For C++, only: 'sizeof... ( parameterPack )'
* @since 5.2 * @since 5.2
*/ */
public static final int op_sizeofParameterPack = 16; public static final int op_sizeofParameterPack = 16;
/** /**
* For c++, only: noexcept ( expression ) * For C++, only: noexcept ( expression )
* @since 5.5 * @since 5.5
*/ */
public static final int op_noexcept = 17; 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 all constants must be defined in this interface
*/ */
@Deprecated @Deprecated
public static final int op_last = op_alignOf; public static final int op_last = op_alignOf;
/** /**
* Get the operator/kind. * {@code OPERAND} represents the relationship between an {@code IASTUnaryExpression} and
* * it's nested {@code IASTExpression}.
* @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>.
*/ */
public static final ASTNodeProperty OPERAND = public static final ASTNodeProperty OPERAND =
new ASTNodeProperty("IASTUnaryExpression.OPERAND - IASTExpression (operand) for IASTUnaryExpression"); //$NON-NLS-1$ 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(); public IASTExpression getOperand();
/** /**
* Set the operand. * Sets the operand.
* *
* @param expression <code>IASTExpression</code> * @param expression {@code IASTExpression}
*/ */
public void setOperand(IASTExpression expression); public void setOperand(IASTExpression expression);

View file

@ -25,7 +25,6 @@ import org.eclipse.cdt.core.dom.ast.IProblemBinding;
* It also handles the impact on the grouping of the sub-expressions. * It also handles the impact on the grouping of the sub-expressions.
*/ */
public abstract class ASTAmbiguousBinaryVsCastExpression extends ASTAmbiguousNode implements IASTAmbiguousExpression { public abstract class ASTAmbiguousBinaryVsCastExpression extends ASTAmbiguousNode implements IASTAmbiguousExpression {
private final IASTBinaryExpression fBinaryExpression; private final IASTBinaryExpression fBinaryExpression;
private final IASTCastExpression fCastExpression; private final IASTCastExpression fCastExpression;

View file

@ -29,7 +29,6 @@ import org.eclipse.cdt.core.dom.ast.IProblemBinding;
* It also handles the impact on the grouping of the sub-expressions. * It also handles the impact on the grouping of the sub-expressions.
*/ */
public abstract class ASTAmbiguousCastVsFunctionCallExpression extends ASTAmbiguousNode implements IASTAmbiguousExpression { public abstract class ASTAmbiguousCastVsFunctionCallExpression extends ASTAmbiguousNode implements IASTAmbiguousExpression {
private final IASTCastExpression fCastExpression; private final IASTCastExpression fCastExpression;
private final IASTFunctionCallExpression fFunctionCallExpression; private final IASTFunctionCallExpression fFunctionCallExpression;
@ -158,7 +157,7 @@ public abstract class ASTAmbiguousCastVsFunctionCallExpression extends ASTAmbigu
} }
owner.replace(nodeToReplace, result); owner.replace(nodeToReplace, result);
// resolve ambiguities in the function-call expression // Resolve ambiguities in the function-call expression
fFunctionCallExpression.getFunctionNameExpression().accept(visitor); fFunctionCallExpression.getFunctionNameExpression().accept(visitor);
return result; return result;
} }
@ -177,8 +176,7 @@ public abstract class ASTAmbiguousCastVsFunctionCallExpression extends ASTAmbigu
default: default:
return null; return null;
} }
} } else if (operand instanceof IASTArraySubscriptExpression) {
else if (operand instanceof IASTArraySubscriptExpression) {
operand= ((IASTArraySubscriptExpression) operand).getArrayExpression(); operand= ((IASTArraySubscriptExpression) operand).getArrayExpression();
} else if (operand instanceof IASTFunctionCallExpression) { } else if (operand instanceof IASTFunctionCallExpression) {
operand= ((IASTFunctionCallExpression) operand).getFunctionNameExpression(); operand= ((IASTFunctionCallExpression) operand).getFunctionNameExpression();

View file

@ -1120,7 +1120,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
throw (CoreException) e; 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(); Throwable exception = s.getException();
if (exception != null) { if (exception != null) {
Throwable masked= getMaskedException(exception); Throwable masked= getMaskedException(exception);

View file

@ -117,8 +117,7 @@ public class CSearchLabelProvider extends LabelProvider implements IStyledLabelP
if (element instanceof TypeInfoSearchElement) { if (element instanceof TypeInfoSearchElement) {
return fTypeInfoLabelProvider.getText(((TypeInfoSearchElement) element).getTypeInfo()); return fTypeInfoLabelProvider.getText(((TypeInfoSearchElement) element).getTypeInfo());
} } else if (element instanceof ProblemSearchElement) {
else if (element instanceof ProblemSearchElement) {
ProblemSearchElement pse= (ProblemSearchElement) element; ProblemSearchElement pse= (ProblemSearchElement) element;
return ASTProblem.getMessage(pse.getProblemID(), pse.getDetail()); return ASTProblem.getMessage(pse.getProblemID(), pse.getDetail());
} }

View file

@ -158,7 +158,9 @@ public class CSearchResult extends AbstractTextSearchResult implements IEditorMa
if (location.getFullPath() != null) { if (location.getFullPath() != null) {
return ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(location.getFullPath())); 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) { } else if (element instanceof CSearchElement) {
CSearchElement searchElement = (CSearchElement) element; CSearchElement searchElement = (CSearchElement) element;
IIndexFileLocation location = searchElement.getLocation(); IIndexFileLocation location = searchElement.getLocation();