diff options
author | Sergey Prigogin | 2016-10-06 00:03:05 +0000 |
---|---|---|
committer | Sergey Prigogin | 2016-10-06 00:13:00 +0000 |
commit | 64aec369e119aea692509da6af6e1f2ddcc47c78 (patch) | |
tree | e278de1ba7f3c52c5e16328e999352945db7813f /codan/org.eclipse.cdt.codan.core.cxx | |
parent | 27f99d2a862e049af7525b1272bdd206353f5005 (diff) | |
download | org.eclipse.cdt-64aec369e119aea692509da6af6e1f2ddcc47c78.tar.gz org.eclipse.cdt-64aec369e119aea692509da6af6e1f2ddcc47c78.tar.xz org.eclipse.cdt-64aec369e119aea692509da6af6e1f2ddcc47c78.zip |
More robust implementation of ControlFlowGraphBuilder.isConstant method
Change-Id: I43fd84e8c374a638834be3c2aeb216b96fc6b461
Diffstat (limited to 'codan/org.eclipse.cdt.codan.core.cxx')
-rw-r--r-- | codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/internal/model/cfg/ControlFlowGraphBuilder.java | 9 |
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 0fcac765920..fe8ad4dfe2a 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; |