Commit Graph

22 Commits

Author SHA1 Message Date
Mathias Vorreiter Pedersen
41425b157f C++: Add test with missing flow. 2024-12-08 23:47:34 +00:00
Simon Friis Vindum
f066f21751 C++: Make swap member functions data-flow functions 2024-09-04 13:55:19 +02:00
Simon Friis Vindum
037912fd2d C++: Add data-flow test for realloc 2024-09-03 14:02:03 +02:00
Mathias Vorreiter Pedersen
cc754858c6 C++: Add a testcase with missing flow out of the address of 'a' and to the argument of 'sink'. 2024-03-06 18:15:49 -08:00
Mathias Vorreiter Pedersen
1ac75def2b C++: Add another testcase with spurious summary flow. 2024-02-01 15:11:52 +00:00
Mathias Vorreiter Pedersen
1753a7e146 C++: Add tests. 2023-11-28 14:27:15 +00:00
Mathias Vorreiter Pedersen
d5442ec9c5 C++: Add regression test. 2023-09-08 13:10:04 +01:00
Mathias Vorreiter Pedersen
f65fe34513 C++: Add false positive caused by flowing back into a function after doing reverse reads. 2023-08-28 14:45:16 +01:00
Mathias Vorreiter Pedersen
c7cff373de C++: Add another testcase with conflation. 2023-06-22 10:59:12 +01:00
Mathias Vorreiter Pedersen
9d64c0a023 C++: Add failing test. 2023-02-27 14:57:35 +00:00
Mathias Vorreiter Pedersen
bfe9ae22ad Merge branch 'main' into mathiasvp/replace-ast-with-ir-use-usedataflow 2023-01-26 13:03:49 +00:00
Mathias Vorreiter Pedersen
510211a4c7 C++: Add testcase with looping behavior in C/C++ def-use flow. 2023-01-24 09:44:30 +00:00
Mathias Vorreiter Pedersen
79b77b01fd Merge branch 'main' into mathiasvp/replace-ast-with-ir-use-usedataflow 2023-01-23 15:49:36 +00:00
Mathias Vorreiter Pedersen
a217017859 C++: Add testcase with looping behavior in C/C++ use-use flow. 2023-01-23 14:29:39 +00:00
Mathias Vorreiter Pedersen
2999243e34 C++: Add failing IR dataflow testcase. 2022-12-12 10:42:59 +00:00
Mathias Vorreiter Pedersen
4f2c2e6d5e C++: Accept test changes. 2022-11-16 14:05:54 +00:00
Jonas Jensen
7c319efb8b C++: Data flow through reference parameters 2019-10-01 10:43:49 +02:00
Ian Lynagh
1d56407c72 C++: Pull some of library-tests/dataflow/dataflow-tests into clang.cpp
g++ doesn't support this code:

    sorry, unimplemented: non-trivial designated initializers not supported
       twoIntFields sSwapped = { .m2 = source(), .m1 = 0 };

so we need to build it in clang mode.
2019-09-05 15:12:17 +01:00
Jonas Jensen
71659594c8 C++: Let data flow past definition by reference
This commit changes how data flow works in the following code.

    MyType x = source();
    defineByReference(&x);
    sink(x);

The question here is whether there should be flow from `source` to
`sink`. Such flow is desirable if `defineByReference` doesn't write to
all of `x`, but it's undesirable if `defineByReference` is a typical
init function in `C` that writes to every field or if
`defineByReference` is `memcpy` or `memset` on the full range.

Before 1.20.0, there would be flow from `source` to `sink` in case `x`
happened to be modeled with `BlockVar` but not in case `x` happened to
be modelled with SSA. The choice of modelling depends on an analysis of
how `x` is used elsewhere in the function, and it's supposed to be an
internal implementation detail that there are two ways to model
variables. In 1.20.0, I changed the `BlockVar` behavior so it worked the
same as SSA, never allowing that flow. It turns out that this change
broke a customer's query.

This commit reverts `BlockVar` to its old behavior of letting flow
propagate past the `defineByReference` call and then regains consistency
by changing all variables that are ever defined by reference to be
modelled with `BlockVar` instead of SSA. This means we now get too much
flow in certain cases, but that appears to be better overall than
getting too little flow. See also the discussion in CPP-336.
2019-04-01 14:13:47 +02:00
Jonas Jensen
5647a1a658 C++: BlockVar value stops at def by ref (partial) 2019-02-27 15:05:53 +01:00
Jonas Jensen
20f3df0d09 C++: Add tests to demo lack dataflow by reference 2019-02-27 13:19:16 +01:00
Pavel Avgustinov
b55526aa58 QL code and tests for C#/C++/JavaScript. 2018-08-02 17:53:23 +01:00