Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/codan
diff options
context:
space:
mode:
authorSergey Prigogin2016-10-06 00:03:05 +0000
committerSergey Prigogin2016-10-06 00:13:00 +0000
commit64aec369e119aea692509da6af6e1f2ddcc47c78 (patch)
treee278de1ba7f3c52c5e16328e999352945db7813f /codan
parent27f99d2a862e049af7525b1272bdd206353f5005 (diff)
downloadorg.eclipse.cdt-64aec369e119aea692509da6af6e1f2ddcc47c78.tar.gz
org.eclipse.cdt-64aec369e119aea692509da6af6e1f2ddcc47c78.tar.xz
org.eclipse.cdt-64aec369e119aea692509da6af6e1f2ddcc47c78.zip
More robust implementation of ControlFlowGraphBuilder.isConstant method
Diffstat (limited to 'codan')
-rw-r--r--codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/internal/model/cfg/ControlFlowGraphBuilder.java9
1 files changed, 3 insertions, 6 deletions
diff --git a/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/internal/model/cfg/ControlFlowGraphBuilder.java b/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/internal/model/cfg/ControlFlowGraphBuilder.java
index 0fcac76592..fe8ad4dfe2 100644
--- a/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/internal/model/cfg/ControlFlowGraphBuilder.java
+++ b/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/internal/model/cfg/ControlFlowGraphBuilder.java
@@ -56,7 +56,6 @@ import org.eclipse.cdt.core.dom.ast.IASTStatement;
import org.eclipse.cdt.core.dom.ast.IASTSwitchStatement;
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
import org.eclipse.cdt.core.dom.ast.IASTWhileStatement;
-import org.eclipse.cdt.core.dom.ast.IValue;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTRangeBasedForStatement;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTryBlockStatement;
@@ -581,11 +580,9 @@ public class ControlFlowGraphBuilder {
if (node instanceof ICfgData) {
IASTNode ast = (IASTNode) ((ICfgData) node).getData();
if (ast instanceof IASTExpression) {
- IValue dvalue = ValueFactory.create((IASTExpression) ast);
- Number numericalValue = dvalue.numberValue();
- if (numericalValue == null)
- return false;
- return numericalValue.longValue() == testvalue;
+ Number numericalValue = ValueFactory.getConstantNumericalValue((IASTExpression) ast);
+ if (numericalValue != null)
+ return numericalValue.longValue() == testvalue;
}
}
return false;

Back to the top