Commit Graph

83 Commits

Author SHA1 Message Date
Jeroen Ketema
3f0ce98ccb C++: Add destructor test cases for AV Rule 114 2024-03-22 10:25:47 +01:00
Paolo Tranquilli
0bfeadbf1f C++: add .def to exception to test 2024-01-09 15:30:27 +01:00
JarLob
3317223e19 Fix AV Rule 76 2022-11-02 22:50:25 +01:00
erik-krogh
33165f4f55 CPP: update expected output 2022-09-23 14:45:59 +02:00
Jeroen Ketema
97d4a12fb2 C++: Add non-returning function test case using __builtin_expect 2022-04-22 17:10:54 +02:00
Jeroen Ketema
1a1c34e1be C++: Handle C11 _Noreturn in DefaultOptions 2022-03-15 23:21:14 +01:00
Geoffrey White
ec952248a9 C++: Test strdup with AV Rule 79. 2021-03-30 12:58:04 +01:00
Geoffrey White
f27203cc43 C++: Test spacing. 2021-03-30 12:57:43 +01:00
Geoffrey White
2fa846d1a6 CPP: Correct test. 2020-01-14 14:33:43 +00:00
Geoffrey White
d98d80b07d CPP: Improve locations for AV Rule 114.ql. 2020-01-14 14:33:43 +00:00
Dave Bartolomeo
6c8de44800 Merge pull request #2604 from geoffw0/returnthis
CPP: Exclude template classes from cpp/assignment-does-not-return-this
2020-01-08 09:12:22 -07:00
Geoffrey White
527d29ba23 CPP: Exclude template classes from the query. 2020-01-08 13:16:38 +00:00
Geoffrey White
d527dbe47a CPP: Add test case. 2020-01-08 13:13:06 +00:00
Geoffrey White
72b4792391 CPP: Exception for AsmStmts. 2020-01-07 12:46:07 +00:00
Geoffrey White
0a85637fef CPP: Add a test. 2020-01-07 12:46:07 +00:00
Geoffrey White
d67ea4d768 CPP: Tests: AV Rule 79 test cases for calloc, realloc and new. 2019-11-22 15:16:32 +00:00
Geoffrey White
7190dd2ef4 CPP: Tests: Rearrange a test prior to changes. 2019-11-22 15:16:32 +00:00
Geoffrey White
5f1fdd08a7 CPP: Post-2115. 2019-10-16 13:51:06 +01:00
Geoffrey White
096af3c3f3 CPP: Add test cases involving __builtin_complex. 2019-10-16 13:46:11 +01:00
Jonas Jensen
4ef5c9af62 C++: Autoformat everything
Some files that will change in #1736 have been spared.

    ./build -j4 target/jars/qlformat
    find ql/cpp/ql -name "*.ql"  -print0 | xargs -0 target/jars/qlformat --input
    find ql/cpp/ql -name "*.qll" -print0 | xargs -0 target/jars/qlformat --input
    (cd ql && git checkout 'cpp/ql/src/semmle/code/cpp/ir/implementation/**/*SSA*.qll')
    buildutils-internal/scripts/pr-checks/sync-identical-files.py --latest
2019-09-09 11:25:53 +02:00
Jonas Jensen
2c253f360a C++: Support x-macros that are #undef'ed in header
This fixes a false positive on https://github.com/zduka/tpp.
2019-08-28 13:03:16 +02:00
Jonas Jensen
e7dfb3e61b C++: Test for x-macro FP observed in the wild 2019-08-28 13:03:09 +02:00
Geoffrey White
7ea6c1bcbe CPP: Add a test of AV Rule 186.ql. 2019-04-10 18:08:10 +01:00
Geoffrey White
9b31b4e364 CPP: Fix false positive. 2019-03-25 11:57:23 +00:00
Geoffrey White
7b88bf7617 CPP: Add a test. 2019-03-25 09:22:18 +00:00
Jonas Jensen
552842346c C++: Fix special-casing of Qt library
The `Expr.getType` predicate returns a pointer type since that's the
type of the `new`-expression as a whole. To find the class type, we use
`NewExpr.getAllocatedType`.

This commit reduces the number of alerts in a Qt snapshot from 229 to
51, and it removes the two false positives in
https://github.com/Subsurface-divelog/subsurface.
2019-03-21 13:37:18 +01:00
Jonas Jensen
a59a9f6075 C++: Add test cases for Qt's QObject
The Qt library requires client code to call `new` but not `delete`.
2019-03-21 13:31:50 +01:00
Jonas Jensen
9561fdaabf Merge pull request #672 from geoffw0/lgtm1605
CPP: Fix function pointer/lambda related false positives in 'Resource not released in destructor'
2019-01-21 09:35:30 +01:00
Aditya Sharad
f92456fcad Merge master into next.
Conflict in `cpp/ql/test/library-tests/sideEffects/functions/sideEffects.expected`,
resolved by accepting test output (combining changes).
2018-12-12 17:26:18 +00:00
Geoffrey White
2f3a874c7d CPP: Fix false positives when a member variable is released via the target of a function pointer. 2018-12-12 11:38:44 +00:00
Geoffrey White
370387a9ca CPP: Fix false positives when member variable is released via an ExprCall. 2018-12-12 11:38:44 +00:00
Geoffrey White
e408f18766 CPP: Fix false positives when member variable is released via capture inside lambda expression. 2018-12-12 11:38:44 +00:00
Geoffrey White
8e2459a6b7 CPP: Add similar test cases with function pointers. 2018-12-12 11:38:44 +00:00
Geoffrey White
77c1ad47f9 CPP: Add test cases with lambdas. 2018-12-12 11:38:44 +00:00
Jonas Jensen
6239455a91 C++: Remove extra type check in AV Rule 82
These type checks were overlapping with `assignOperatorWithWrongType` is
are no longer needed now that `assignOperatorWithWrongType` is improved.
They were causing FPs and misleading error messages on uninstantiated
templates.
2018-12-04 12:59:21 +01:00
Jonas Jensen
8ac427c387 C++: Add missing getUnspecifiedType in AV Rule 82
Adding this call to `getUnspecifiedType` makes the error message better
in the presence of typedefs and qualifiers on an assignment operator
return type. It's also needed to avoid losing valid results in the
commit that comes after this.
2018-12-04 11:13:11 +01:00
Jonas Jensen
a78ded7551 C++: Demonstrate FP in AV Rule 82
The added test is a reduced version of a FP observed in the wild.
2018-12-04 11:09:35 +01:00
Geoffrey White
dfbccc4bcf CPP: Additional test cases. 2018-12-03 13:11:52 +00:00
Geoffrey White
0eb0bf988e CPP: Fix for virtual method calls. 2018-11-28 14:19:24 +00:00
Geoffrey White
7107cec503 CPP: Add test cases. 2018-11-27 17:20:14 +00:00
Aditya Sharad
c20b688a3f Merge master into next. 2018-11-23 16:36:31 +00:00
Jonas Jensen
6c0305cb80 Merge pull request #495 from geoffw0/returnvalue
CPP: Fix 'Missing return statement'
2018-11-20 10:16:30 +01:00
Geoffrey White
5cae65295d CPP: Fix FPs from AV Rule 114.ql. 2018-11-19 16:09:40 +00:00
Geoffrey White
d18a7012f5 CPP: Add a test case. 2018-11-19 16:08:32 +00:00
Jonas Jensen
6d17642240 Merge pull request #476 from geoffw0/av_165
CPP: Fix AV Rule 165
2018-11-19 14:32:02 +01:00
Geoffrey White
d1adc0e3ec CPP: Fix for explicitly cast expressions. 2018-11-14 19:43:24 +00:00
Geoffrey White
3028e85457 CPP: Add a test of AV Rule 164. 2018-11-14 19:40:29 +00:00
Geoffrey White
3f428a8876 CPP: Fix for explicitly cast expressions. 2018-11-14 19:11:56 +00:00
Geoffrey White
5cddabb1fd CPP: Add a test of AV Rule 165. 2018-11-14 19:05:35 +00:00
Aditya Sharad
f0715b09e1 Merge master into next. 2018-11-14 10:06:27 +00:00