Commit Graph

84550 Commits

Author SHA1 Message Date
Rasmus Wriedt Larsen
2aa5ae41fb Python: Fix join-order problem in SqlAlchemy
No major performance impact, more of a learning example for myself (had +3000 join order badness).

Initial tuple counts

```
Evaluated recursive predicate SqlAlchemy::SqlAlchemy::Connection::ConnectionConstruction#45e716e0@594cfx2g in 1ms on iteration 1 (delta size: 4).
Evaluated relational algebra for predicate SqlAlchemy::SqlAlchemy::Connection::ConnectionConstruction#45e716e0@594cfx2g on iteration 1 running pipeline base with tuple counts:
        37793   ~0%    {3} r1 = JOIN `ApiGraphs::API::Node.getACall/0#dispred#312deb92_10#join_rhs` WITH DataFlowPublic::CallCfgNode#b8ddbf81 ON FIRST 1 OUTPUT Lhs.1, Lhs.0, Rhs.1
            0   ~0%    {2}    | JOIN WITH `SqlAlchemy::SqlAlchemy::Connection::classRef/0#565fc3ad` ON FIRST 1 OUTPUT Lhs.1, Lhs.2

           30   ~0%    {5} r2 = JOIN DataFlowPublic::CallCfgNode#b8ddbf81 WITH `DataFlowPublic::MethodCallNode.calls/2#dispred#1dd1e0f4#ffb` ON FIRST 1 OUTPUT Lhs.0, Lhs.1, Rhs.1, Rhs.2, _
                       {4}    | REWRITE WITH NOT [NOT [Tmp.4 := "begin", TEST InOut.3 = Tmp.4], NOT [Tmp.4 := "connect", TEST InOut.3 = Tmp.4]] KEEPING 4
           21   ~0%    {3}    | SCAN OUTPUT In.2, In.0, In.1
            4   ~0%    {2}    | JOIN WITH `SqlAlchemy::SqlAlchemy::Engine::instance/0#1828baef` ON FIRST 1 OUTPUT Lhs.1, Lhs.2

            4   ~0%    {2} r3 = r1 UNION r2
                       return r3
```

which is fixed by the only_bind_out

```
Evaluated recursive predicate SqlAlchemy::SqlAlchemy::Connection::ConnectionConstruction#45e716e0@49effxtg in 0ms on iteration 1 (delta size: 0).
Evaluated relational algebra for predicate SqlAlchemy::SqlAlchemy::Connection::ConnectionConstruction#45e716e0@49effxtg on iteration 1 running pipeline base with tuple counts:
        0  ~0%    {1} r1 = JOIN `SqlAlchemy::SqlAlchemy::Connection::classRef/0#565fc3ad` WITH `ApiGraphs::API::Node.getACall/0#dispred#312deb92` ON FIRST 1 OUTPUT Rhs.1
        0  ~0%    {2}    | JOIN WITH DataFlowPublic::CallCfgNode#b8ddbf81 ON FIRST 1 OUTPUT Lhs.0, Rhs.1
                  return r1
```

We also had this initial problem

```
Evaluated recursive predicate SqlAlchemy::SqlAlchemy::Connection::ConnectionConstruction#45e716e0@594cfx2g in 1ms on iteration 4 (delta size: 0).
Evaluated relational algebra for predicate SqlAlchemy::SqlAlchemy::Connection::ConnectionConstruction#45e716e0@594cfx2g on iteration 4 running pipeline standard with tuple counts:
        48722   ~6%    {2} r1 = DataFlowPublic::CallCfgNode#b8ddbf81 AND NOT SqlAlchemy::SqlAlchemy::Connection::ConnectionConstruction#45e716e0#prev(FIRST 2)

        48722   ~3%    {3} r2 = SCAN r1 OUTPUT In.0, _, In.1
        48722   ~1%    {3}    | REWRITE WITH Out.1 := "connect"
           16   ~0%    {3}    | JOIN WITH `DataFlowPublic::MethodCallNode.calls/2#dispred#1dd1e0f4#ffb_021#join_rhs` ON FIRST 2 OUTPUT Rhs.2, Lhs.0, Lhs.2
            0   ~0%    {2}    | JOIN WITH `SqlAlchemy::SqlAlchemy::Connection::instance/0#5ed87c17#prev_delta` ON FIRST 1 OUTPUT Lhs.1, Lhs.2

        48722   ~3%    {3} r3 = SCAN r1 OUTPUT In.0, _, In.1
        48722   ~2%    {3}    | REWRITE WITH Out.1 := "execution_options"
            9   ~0%    {3}    | JOIN WITH `DataFlowPublic::MethodCallNode.calls/2#dispred#1dd1e0f4#ffb_021#join_rhs` ON FIRST 2 OUTPUT Rhs.2, Lhs.0, Lhs.2
            0   ~0%    {2}    | JOIN WITH `SqlAlchemy::SqlAlchemy::Connection::instance/0#5ed87c17#prev_delta` ON FIRST 1 OUTPUT Lhs.1, Lhs.2

            0   ~0%    {2} r4 = r2 UNION r3
                       return r4
```

which is fixed by `connectionConstruction_helper`

```
Evaluated recursive predicate SqlAlchemy::SqlAlchemy::Connection::helper/0#62cfc178#b@4f295yef in 1ms on iteration 4 (delta size: 0).
Evaluated relational algebra for predicate SqlAlchemy::SqlAlchemy::Connection::helper/0#62cfc178#b@4f295yef on iteration 4 running pipeline standard with tuple counts:
         4  ~0%    {1} r1 = JOIN `SqlAlchemy::SqlAlchemy::Connection::instance/1#029b4c87#prev_delta` WITH `TypeTrackingImpl::TypeTracker::end/0#2ac2cfd4` ON FIRST 1 OUTPUT Lhs.1
        16  ~0%    {1}    | JOIN WITH `LocalSources::Cached::hasLocalSource/2#8b3ee0ec_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1
         0  ~0%    {3}    | JOIN WITH `DataFlowPublic::MethodCallNode.calls/2#dispred#1dd1e0f4#ffb_102#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Rhs.2, _
         0  ~0%    {2}    | REWRITE WITH NOT [NOT [Tmp.2 := "connect", TEST InOut.1 = Tmp.2], NOT [Tmp.2 := "execution_options", TEST InOut.1 = Tmp.2]] KEEPING 2
         0  ~0%    {1}    | JOIN WITH DataFlowPublic::CallCfgNode#b8ddbf81 ON FIRST 1 OUTPUT Lhs.0
         0  ~0%    {1}    | AND NOT `SqlAlchemy::SqlAlchemy::Connection::helper/0#62cfc178#b#prev`(FIRST 1)
                   return r1
```
2024-03-21 11:55:49 +01:00
Jeroen Ketema
4c4ebd907e C++: Update more expected test results 2024-03-21 11:54:29 +01:00
Jeroen Ketema
a3ae304dfe C++: Handle getInitializingExpr in PrintAST 2024-03-21 11:32:23 +01:00
Jeroen Ketema
33c524d9fd Merge pull request #16003 from jketema/destructors18
C++: Add tests showing missing destructors for initialization statements
2024-03-21 11:28:54 +01:00
Tamas Vajk
9d655520cc Code quality improvement 2024-03-21 11:26:45 +01:00
Mathias Vorreiter Pedersen
dc5ee7c8b4 Merge pull request #16007 from MathiasVP/fix-tls-settings-misconfiguration
C++: Fix `cpp/boost/tls-settings-misconfiguration` FPs
2024-03-21 10:16:37 +00:00
Mathias Vorreiter Pedersen
7fb64268bd Merge pull request #15997 from MathiasVP/simplify-guard-in-missing-check-scanf
C++: Simplify use of guard conditions in `cpp/missing-check-scanf`
2024-03-21 10:16:12 +00:00
Tamas Vajk
d0c09f43a9 Add change note 2024-03-21 11:13:42 +01:00
Paolo Tranquilli
eb7f07dc3f Merge pull request #15967 from github/redsun82/test
Swift: add `-headerpad_max_install_names` to link options
2024-03-21 11:11:53 +01:00
Tom Hvitved
c0f80ecd2f Merge pull request #15994 from hvitved/csharp/no-trap-stack-in-buildless
C#: Avoid using TRAP stack in buildless mode
2024-03-21 10:46:08 +01:00
erik-krogh
54a1c25276 change the precision of the js/unsafe-external-link query to low 2024-03-21 10:32:15 +01:00
Tamas Vajk
9da8cb1165 C#: Simplify the output of cs/wrong-compareto-signature to remove entity locations 2024-03-21 10:27:55 +01:00
Jeroen Ketema
06313b9bb6 Merge pull request #15998 from MathiasVP/simplify-guard-in-incorrectly-check-scanf
C++: Simplify use of guard conditions in `cpp/incorrectly-checked-scanf`
2024-03-21 10:10:03 +01:00
Jeroen Ketema
84646cd795 C++: Add tests showing missing destructors for initialization statements
Incidentially this also shows that for contructs like `if (char x = ...)`, so
there is an initialization but not initializer statement, the initialization
is not displayed in the AST, although the IR does contain the initialization.
2024-03-21 09:40:00 +01:00
Michael Nebel
6619be3137 Merge pull request #15940 from michaelnebel/csharp/sourcesinktests
C#: Source- and sink tests.
2024-03-21 08:12:16 +01:00
Jeroen Ketema
ec071cde51 Merge pull request #15991 from jketema/destructors17
C++: Handle destruction of temporaries in expressions with a `thow` at the root
2024-03-21 07:47:09 +01:00
Jeroen Ketema
9300b04def C++: Update test results 2024-03-21 00:05:30 +01:00
Henry Mercer
a76832f4e0 Mark LOC queries as debug instead 2024-03-20 21:18:55 +00:00
Tom Hvitved
8f56edea80 Merge pull request #15966 from hvitved/treesitter-split-up-node-info-table
Tree-sitter: Split up `ast_node_info` table into two tables
2024-03-20 20:38:18 +01:00
Mathias Vorreiter Pedersen
0ef8c7d87f C++: Accept test changes. 2024-03-20 18:05:14 +00:00
Mathias Vorreiter Pedersen
1330c885c8 C++: Use 'asIndirectExpr' in the sink of 'ExistsAnyFlowConfig. 2024-03-20 18:04:59 +00:00
Mathias Vorreiter Pedersen
f31bb1391d C++: Simplify 'checkedForEof'. 2024-03-20 16:59:39 +00:00
Mathias Vorreiter Pedersen
5476f42d2c C++: Simplify use of 'GuardCondition's in 'cpp/missing-check-scanf'. 2024-03-20 16:44:43 +00:00
Mathias Vorreiter Pedersen
e3be2057d3 Merge pull request #15996 from MathiasVP/missing-check-scanf-path-problem
Make `cpp/missing-check-scanf` a `path-problem` query
2024-03-20 16:42:47 +00:00
Mathias Vorreiter Pedersen
96cd259eda C++: Add change note. 2024-03-20 14:56:39 +00:00
Mathias Vorreiter Pedersen
14aff5c94c C++: Convert 'cpp/missing-check-scanf' to a path-problem query. 2024-03-20 14:54:53 +00:00
Mathias Vorreiter Pedersen
0fe3072a65 Merge pull request #15988 from MathiasVP/clean-up-missing-check-scanf
C++: Rewrite 'cpp/missing-check-scanf' to use standard dataflow configs
2024-03-20 14:50:08 +00:00
Mathias Vorreiter Pedersen
ebac171b2b Java/Shared: Rename 'joinStep0' to 'joinStep'. 2024-03-20 14:40:16 +00:00
Mathias Vorreiter Pedersen
6a65c46b2e Java/Shared: Share more 'isNull' computations. 2024-03-20 14:36:12 +00:00
Mathias Vorreiter Pedersen
90fbacc7bf Java/Shared: Use getLocation instead of hasLocationInfo. 2024-03-20 14:29:48 +00:00
Michael Nebel
969676975d C#: Address review comments. 2024-03-20 15:28:56 +01:00
Michael B. Gale
616015fddf Merge pull request #15935 from github/mbg/go/speed-up-dependencies 2024-03-20 14:26:46 +00:00
Tom Hvitved
79dc7fcc04 C#: Avoid using TRAP stack in buildless mode 2024-03-20 15:21:36 +01:00
Taus
1d38ca371b Merge pull request #15845 from github/tausbn/python-extractor-fix-build
Python: Build external extractor
2024-03-20 15:18:59 +01:00
Michael B. Gale
648543f2fb Merge pull request #15989 from github/mbg/docs/go-1.22
Docs: Add Go 1.22 to supported versions range
2024-03-20 14:04:26 +00:00
Michael B. Gale
c74d6348f9 Go: Run go with a valid toolchain version if we have found an invalid one 2024-03-20 13:55:37 +00:00
Michael B. Gale
0d527b2f75 Go: Keep track of all installed toolchains that we know of 2024-03-20 13:52:06 +00:00
Jeroen Ketema
1fd11928eb Merge pull request #15978 from jketema/destructors16
C++: Handle destructors at temporary object lifetime expressions
2024-03-20 14:24:10 +01:00
Ian Lynagh
9086ec8b13 Merge pull request #15973 from igfoo/igfoo/exprs
Kotlin 2: Accept more test changes
2024-03-20 13:13:56 +00:00
Michael B. Gale
96a6dd72cd Go: Move go version command construction into its own function 2024-03-20 13:08:59 +00:00
Michael B. Gale
c71ba0361e Docs: Add Go 1.22 to supported versions range 2024-03-20 12:12:20 +00:00
Mathias Vorreiter Pedersen
c9dbb7c5a9 C++: Rewrite 'cpp/missing-check-scanf' to use standard dataflow configurations. 2024-03-20 12:01:57 +00:00
Michael B. Gale
06134467e9 Go: Make CODEQL_EXTRACTOR_GO_FAST_PACKAGE_INFO true by default 2024-03-20 12:01:49 +00:00
Ian Lynagh
3fa7532b43 Kotlin 2: Accept more test changes 2024-03-20 11:46:58 +00:00
Cornelius Riemenschneider
8fbd743e9e Merge pull request #15971 from github/criemen/bazel-7-1
Upgrade to bazel 7.1
2024-03-20 12:27:03 +01:00
Mathias Vorreiter Pedersen
7ff2998c88 Merge pull request #15980 from MathiasVP/guards-lt
C++: Support `<` reasoning for `switch` statements in Guards library
2024-03-20 10:40:39 +00:00
Mathias Vorreiter Pedersen
3a7b80da47 C++: Respond to review comments. 2024-03-20 10:12:29 +00:00
Mathias Vorreiter Pedersen
9179f0bda6 Merge pull request #15969 from MathiasVP/disable-some-constant-folding
C++: Disable _some_ constant folding in IR
2024-03-20 09:25:06 +00:00
Arthur Baars
1d956e1039 Merge pull request #15974 from github/dbartol/rc3.13-mergeback
Mergeback from `rc/3.13`
2024-03-20 10:13:32 +01:00
erik-krogh
db3bf0e482 use the sanitizers from ReflectedXSS in unsafe-html-construction 2024-03-20 10:11:07 +01:00