Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 18d3801

Browse files
authored
Merge pull request #11033 from MathiasVP/exclude-void-calls
C++: Don't create `DataFlow::Node`s for `void`-typed instructions
2 parents 20b188f + f3be58e commit 18d3801

3 files changed

Lines changed: 9 additions & 1384 deletions

File tree

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,14 @@ private module Cached {
3333
*/
3434
cached
3535
newtype TIRDataFlowNode =
36-
TInstructionNode(Instruction i) { not Ssa::ignoreInstruction(i) } or
36+
TInstructionNode(Instruction i) {
37+
not Ssa::ignoreInstruction(i) and
38+
// We exclude `void`-typed instructions because they cannot contain data.
39+
// However, if the instruction is a glvalue, and their type is `void`, then the result
40+
// type of the instruction is really `void*`, and thus we still want to have a dataflow
41+
// node for it.
42+
(not i.getResultType() instanceof VoidType or i.isGLValue())
43+
} or
3744
TOperandNode(Operand op) { not Ssa::ignoreOperand(op) } or
3845
TVariableNode(Variable var) or
3946
TPostFieldUpdateNode(FieldAddress operand, int indirectionIndex) {

0 commit comments

Comments
 (0)