Skip to main content
summaryrefslogtreecommitdiffstats
path: root/codan
diff options
context:
space:
mode:
authorAlena Laskavaia2015-02-22 22:06:50 -0500
committerAlena Laskavaia2015-02-22 22:06:50 -0500
commit8968b8f2ca921389bc0d8332d05deb0798232c7a (patch)
tree7f8a7c5dbf337bda460517f8e1b847c54443dc22 /codan
parent3e7f1d284b97d128a363c7bd5f466a81e5ab4c51 (diff)
downloadorg.eclipse.cdt-8968b8f2ca921389bc0d8332d05deb0798232c7a.tar.gz
org.eclipse.cdt-8968b8f2ca921389bc0d8332d05deb0798232c7a.tar.xz
org.eclipse.cdt-8968b8f2ca921389bc0d8332d05deb0798232c7a.zip
codan - code cleanup
Diffstat (limited to 'codan')
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java2
-rw-r--r--codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/CodanTestCase.java3
-rw-r--r--codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/TestUtils.java2
-rw-r--r--codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/QuickFixTestCase.java2
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/cfg/NodeFactory.java27
5 files changed, 12 insertions, 24 deletions
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java
index be4d6be0af..c4e4854b25 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java
@@ -14,7 +14,6 @@ package org.eclipse.cdt.codan.internal.checkers;
import java.util.Collection;
import java.util.Iterator;
-import java.util.LinkedHashSet;
import org.eclipse.cdt.codan.core.cxx.CxxAstUtils;
import org.eclipse.cdt.codan.core.cxx.model.AbstractAstFunctionChecker;
@@ -192,7 +191,6 @@ public class ReturnChecker extends AbstractAstFunctionChecker {
}
public Collection<IBasicBlock> getDeadBlocks(IASTFunctionDefinition func) {
- Collection<IBasicBlock> result = new LinkedHashSet<IBasicBlock>();
IControlFlowGraph graph = getModelCache().getControlFlowGraph(func);
return ((ControlFlowGraph) graph).getDeadNodes();
}
diff --git a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/CodanTestCase.java b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/CodanTestCase.java
index 885c9415d5..22107d096e 100644
--- a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/CodanTestCase.java
+++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/CodanTestCase.java
@@ -84,7 +84,7 @@ public class CodanTestCase extends BaseTestCase {
}
@Override
- public void tearDown() throws CoreException {
+ public void tearDown() throws Exception {
if (cproject != null) {
try {
cproject.getProject().delete(IResource.FORCE | IResource.ALWAYS_DELETE_PROJECT_CONTENT, new NullProgressMonitor());
@@ -92,6 +92,7 @@ public class CodanTestCase extends BaseTestCase {
throw e;
}
}
+ super.tearDown();
}
/**
diff --git a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/TestUtils.java b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/TestUtils.java
index 6417d4f6cb..59a93cea19 100644
--- a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/TestUtils.java
+++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/TestUtils.java
@@ -61,6 +61,8 @@ public class TestUtils {
InputStream st = null;
if (plugin != null) {
URL resource = plugin.getBundle().getResource(srcRoot + "/" + classFile);
+ if (resource == null)
+ throw new IOException("Cannot find file " + srcRoot + "/" + classFile + " in bundle " + plugin.getBundle().getBundleId());
st = resource.openStream();
} else {
st = clazz.getResourceAsStream("/" + classFile);
diff --git a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/QuickFixTestCase.java b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/QuickFixTestCase.java
index cae78762be..29f2ea1e3d 100644
--- a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/QuickFixTestCase.java
+++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/QuickFixTestCase.java
@@ -80,7 +80,7 @@ public abstract class QuickFixTestCase extends CheckerTestCase {
}
@Override
- public void tearDown() throws CoreException {
+ public void tearDown() throws Exception {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/cfg/NodeFactory.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/cfg/NodeFactory.java
index a1266d0470..067ce97e1a 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/cfg/NodeFactory.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/cfg/NodeFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Alena Laskavaia
+ * Copyright (c) 2009, 2010 Alena Laskavaia
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,7 +12,6 @@ package org.eclipse.cdt.codan.internal.core.cfg;
import org.eclipse.cdt.codan.core.model.cfg.IBranchNode;
import org.eclipse.cdt.codan.core.model.cfg.IConnectorNode;
-import org.eclipse.cdt.codan.core.model.cfg.IControlFlowGraph;
import org.eclipse.cdt.codan.core.model.cfg.IDecisionNode;
import org.eclipse.cdt.codan.core.model.cfg.IExitNode;
import org.eclipse.cdt.codan.core.model.cfg.IJumpNode;
@@ -24,24 +23,12 @@ import org.eclipse.cdt.codan.core.model.cfg.IStartNode;
* Factory that creates cfg nodes
*/
public class NodeFactory implements INodeFactory {
- IControlFlowGraph graph;
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.eclipse.cdt.codan.provisional.core.model.cfg.INodeFactory#
- * getControlFlowGraph()
- */
- public IControlFlowGraph getControlFlowGraph() {
- return graph;
- }
-
public NodeFactory() {
}
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.cdt.codan.core.model.cfg.INodeFactory#createPlainNode ()
*/
@Override
@@ -51,7 +38,7 @@ public class NodeFactory implements INodeFactory {
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.cdt.codan.core.model.cfg.INodeFactory#createJumpNode ()
*/
@Override
@@ -61,7 +48,7 @@ public class NodeFactory implements INodeFactory {
/*
* (non-Javadoc)
- *
+ *
* @seeorg.eclipse.cdt.codan.provisional.core.model.cfg.INodeFactory#
* createDecisionNode()
*/
@@ -72,7 +59,7 @@ public class NodeFactory implements INodeFactory {
/*
* (non-Javadoc)
- *
+ *
* @seeorg.eclipse.cdt.codan.provisional.core.model.cfg.INodeFactory#
* createConnectiorNode()
*/
@@ -83,7 +70,7 @@ public class NodeFactory implements INodeFactory {
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.cdt.codan.core.model.cfg.INodeFactory#createStartNode ()
*/
@Override
@@ -93,7 +80,7 @@ public class NodeFactory implements INodeFactory {
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.cdt.codan.core.model.cfg.INodeFactory#createExitNode ()
*/
@Override

Back to the top