Commit Graph

5370 Commits

Author SHA1 Message Date
ihsinme
4e28887689 Create test3.cpp 2022-07-04 11:13:07 +03:00
ihsinme
1ce42dcd30 Create test2.cpp 2022-07-04 11:12:34 +03:00
ihsinme
6d800de377 Create test1.cpp 2022-07-04 11:11:49 +03:00
Jeroen Ketema
82c9b8b494 C++: Ensure only one Variable exists for every global variable
Depending on the extraction order, before this change there might be multiple
`GlobalVariable`s per declared global variable. See the tests in
`cpp/ql/test/library-tests/variables/global`. This change ensures that only one
of those `GlobalVariable`s is visible to the user if we can locate a unique
definition. If not, the old situation persists.

Note that an exception needs to be made for templated variables. Here, the
definition refers to the non-instantiated template, while a declaration that
is not a definition refers to an instantiation. In case the instantiation refers
to a template parameter, the mangled names of the template and the instantiation
will be identical. This happens for example in the following case:
```
template <typename T>
T x = T(42);           // Uninstantiated templated variable

template <typename T>
class C {
  T y = x<T>;          // Instantiation using a template parameter
};
```
Since the uninstantiated template and the instantiation are two different
entities, we do not unify them as described above.
2022-06-28 15:32:43 +02:00
Geoffrey White
20c3182437 Merge pull request #9087 from ihsinme/ihsinme-patch-88
CPP: Add query for CWE-670: Always-Incorrect Control Flow Implementation when use SSL_shutdown
2022-06-23 09:16:55 +01:00
Robert Marsh
813a8548d7 C++: accept test changes for globals in data flow 2022-06-22 16:42:42 -04:00
Jeroen Ketema
f9e09da604 Merge pull request #9643 from jketema/namespace-variable-test
C++: Add variable in namespace test
2022-06-22 15:58:26 +02:00
Mathias Vorreiter Pedersen
1febe87356 Merge pull request #9644 from jketema/class-entry-fix
C++: Ensure we can round trip between (forward) class declarations
2022-06-22 14:12:11 +01:00
Jeroen Ketema
b1dd8da587 C++: Fix query formatting 2022-06-22 12:59:49 +02:00
Anders Schack-Mulligen
df6d68b215 Merge pull request #9618 from aschackmull/dataflow/deprecate-barrierguard-class
Dataflow: Deprecate BarrierGuard class
2022-06-22 10:44:08 +02:00
Jeroen Ketema
880c785efe C++: Ensure we can round trip between (forward) class declarations
This was already possible when the forward class declaration and the class
definition occurred in the same scope. However, there is a common C++ usage
pattern in which this is not the case (when only a pointer to the class is
needed). In this latter scenario we could not round trip between the (forward)
`DeclarationEntry` and the `Declaration`.

Effectively this changes the code to:
```
if exists(TypeDeclarationEntry e | e.getType() = this)
then result.getType() = this
else ...
```
We use `type_decls` instead to stay close to the original code.
2022-06-22 07:58:45 +02:00
Jeroen Ketema
0f37e4e7b2 C++: Add variable in namespace test 2022-06-22 07:56:27 +02:00
Jeroen Ketema
a8833a0c70 C++: Test showing going from a forward class declaration to a class but not back 2022-06-22 07:53:50 +02:00
Jeroen Ketema
40e0356177 C++: Test that we can go from a DeclarationEntry to a Declaration and back 2022-06-22 07:53:50 +02:00
Jeroen Ketema
1f97f1d931 C++: Add global variable tests 2022-06-21 10:43:40 +02:00
Robert Marsh
d28c39cd73 C++: update test expectations 2022-06-20 15:56:00 -04:00
Robert Marsh
5a3e546bfe C++: update test expectations 2022-06-20 15:55:50 -04:00
Robert Marsh
33910a85b9 C++: restrict global variable IR generation 2022-06-20 15:51:44 -04:00
Robert Marsh
54488eb49b C++: fix global vars accesses in global vars 2022-06-20 15:46:49 -04:00
Robert Marsh
a3f1d61913 C++: test for global var access in a global var 2022-06-20 15:26:28 -04:00
Robert Marsh
048e5d8474 C++: IR data flow through global variables 2022-06-20 15:15:45 -04:00
Robert Marsh
c216176de1 C++: sync and accept new consistency test 2022-06-20 15:15:40 -04:00
Robert Marsh
f0634140b6 C++: fix inconsistencies from IR global vars 2022-06-20 14:41:10 -04:00
Jeroen Ketema
89d4f84731 C++: Update tests for frontend update 2022-06-20 14:41:09 -04:00
Robert Marsh
e0878d7d3c C++: Fix IR variable reuse for global var inits 2022-06-20 14:41:02 -04:00
Robert Marsh
767b0cfdfb Revert "Merge pull request #8933 from MathiasVP/revert-globals"
This reverts commit 2517371a37, reversing
changes made to db856798b9.
2022-06-20 14:26:10 -04:00
Mathias Vorreiter Pedersen
35c8ca15f5 Merge pull request #8912 from rdmarsh2/rdmarsh2/fix-ir-globals
C++: Fix IR variable reuse for global var inits
2022-06-20 16:45:39 +01:00
Rasmus Wriedt Larsen
ae44a941f9 Merge pull request #9421 from RasmusWL/inline-brackets
Inline Expectation Tests: Allow `tag[foo bar]`
2022-06-20 10:01:19 +02:00
Rasmus Wriedt Larsen
b65a10d1ef Inline Expectation Tests: sync 2022-06-17 17:38:19 +02:00
Anders Schack-Mulligen
bbb8d29442 C/C++: Deprecate BarrierGuard class. 2022-06-17 14:29:05 +02:00
Jeroen Ketema
a7d095e063 Revert "C++: Fix test failures where location of reference dereference in lambda changed"
This reverts commit 8e7066600a.
2022-06-15 11:58:31 +02:00
Robert Marsh
e7e517bd6f C++: Accept more updated test output 2022-06-14 15:54:50 -04:00
Robert Marsh
d508826b0f Merge branch 'main' into rdmarsh2/fix-ir-globals 2022-06-14 13:22:04 -04:00
Robert Marsh
07a0b4df84 C++: update test expaectations 2022-06-14 11:43:05 -04:00
Geoffrey White
2683d011c0 Update cpp/ql/test/library-tests/controlflow/dereferenced/dereferenced.cpp
Co-authored-by: Mathias Vorreiter Pedersen <mathiasvp@github.com>
2022-06-14 14:33:37 +01:00
Geoffrey White
512731a38d C++: Add test for Dereferenced.qll. 2022-06-14 13:53:28 +01:00
Robert Marsh
5f77552c37 Merge branch 'main' into rdmarsh2/fix-ir-globals 2022-06-13 12:43:08 -04:00
Rasmus Wriedt Larsen
50196d099b Inline Expectation Tests: sync 2022-06-03 11:39:57 +02:00
ihsinme
77e4d05ea3 Update test.cpp 2022-06-02 14:33:59 +03:00
ihsinme
872dd0d59f Update DangerousUseMbtowc.expected 2022-06-02 14:33:06 +03:00
Geoffrey White
2bcf7e17c8 Understand syscalls better. 2022-05-26 14:01:09 +01:00
Geoffrey White
e3ea7751d1 C++: Define sources better so that we catch all the test cases. 2022-05-26 12:44:17 +01:00
ihsinme
5a9061e45b create new branchihsinme-patch-102 in fork 2022-05-21 14:19:34 +00:00
Robert Marsh
6d267be1a1 C++: merge main and accept test changes 2022-05-20 14:37:09 -04:00
Nick Rolfe
1115227f9d Merge remote-tracking branch 'origin/main' into nickrolfe/misspelling 2022-05-12 16:10:27 +01:00
Mathias Vorreiter Pedersen
39551fd84d Merge pull request #9114 from geoffw0/xxe7
C++: Repair support for createLSParser in the CWE-611 XXE query.
2022-05-12 15:47:53 +01:00
Jeroen Ketema
941485d66f Merge pull request #9130 from jketema/cpp17-init
C++: Handle C++17 if and switch initializers
2022-05-12 16:37:44 +02:00
Geoffrey White
df30d2286c Merge branch 'main' into xxe7 2022-05-12 14:35:16 +01:00
Nick Rolfe
76cf8d1659 C++: fix typos in comments 2022-05-12 14:28:26 +01:00
Jeroen Ketema
71c019e126 C++: Handle C++17 switch initializers 2022-05-12 12:56:50 +02:00