Commit Graph

5486 Commits

Author SHA1 Message Date
Robert Marsh
85cfb0202f C++: add HashCons for delete expressions 2018-09-10 12:22:43 -07:00
Robert Marsh
752f39b537 C++: initial support for aggregate initializers 2018-09-10 12:22:43 -07:00
Robert Marsh
8f446aa9cc C++: fix handling of aligned allocators 2018-09-10 12:22:43 -07:00
Robert Marsh
5549b6fcab C++: HashCons for new, new[], sizeof, alignof 2018-09-10 12:22:43 -07:00
Robert Marsh
fede8d63d4 C++: respond to PR comments 2018-09-10 12:22:43 -07:00
Robert Marsh
e6314c5f35 C++: add support for enums in HashCons 2018-09-10 12:22:43 -07:00
Robert Marsh
91da02bacf C++: uniqueness fixes for HashCons 2018-09-10 12:22:42 -07:00
Robert Marsh
3a5eb03055 C++: change floating point value in test 2018-09-10 12:22:42 -07:00
Robert Marsh
77c5a8e7bf C++: support impure binary operations in HashCons 2018-09-10 12:22:42 -07:00
Robert Marsh
b8bd285d64 C++: support functions in HashCons 2018-09-10 12:22:42 -07:00
Robert Marsh
a8895f4bed C++: Support crement ops in HashCons 2018-09-10 12:22:42 -07:00
Robert Marsh
cf222c51ac C++: treat constant-valued exprs structurally 2018-09-10 12:22:42 -07:00
Robert Marsh
d8dc75abf4 C++: rename HashCons test 2018-09-10 12:22:41 -07:00
Robert Marsh
8b8ec7c5aa C++: add literal tests 2018-09-10 12:22:41 -07:00
Robert Marsh
3c6a9c08a2 C++: first tests for HashCons 2018-09-10 12:22:41 -07:00
Jonas Jensen
6bfbd21390 Merge pull request #159 from ian-semmle/EnumConstant
C++: Fix spurious extra qualified names for enum constants within a class
2018-09-08 14:55:33 +02:00
Nick Rolfe
2abf91b6ab C++: class and test for clang's __builtin_addressof 2018-09-07 12:35:12 +01:00
Nick Rolfe
93103e1042 C++: add class and test for a GNU vector fill operation 2018-09-07 12:07:28 +01:00
Jonas Jensen
69e915639d Merge branch 'master-to-next-20180905-master' into master-to-next-20180905 2018-09-05 21:08:06 +02:00
Aditya Sharad
f27945216f Merge rc/1.18 into master. 2018-09-05 15:32:30 +01:00
Aditya Sharad
cbdbda3723 Merge rc/1.18 into next. 2018-09-05 14:09:06 +01:00
Ian Lynagh
ca082be371 C++: Fix spurious extra qualified names for enum constants within a class 2018-09-05 12:29:43 +01:00
Ian Lynagh
c204ec3a8f C++: Enhance qualifiers/class-enum test 2018-09-05 12:28:57 +01:00
Jonas Jensen
43704e2f0d Merge pull request #144 from ian-semmle/topLevel2
C++: Improve GlobalNamespace.getADeclaration()
2018-09-04 20:22:22 +02:00
Geoffrey White
ae80b8dbec Merge pull request #145 from nickrolfe/rewording
C++: clearer alert wording in integer-multiplication-cast-to-long
2018-09-04 18:00:37 +01:00
Dave Bartolomeo
4086a8909b C++: Fix a couple IR-related tests to handle new directory tree
Also moved those tests under the IR test directory, so I'm less likely to forget them next time.
2018-09-04 09:05:33 -07:00
Dave Bartolomeo
fce7a5fccb C++: Final IR reshuffle
Moved IR flavors into "implementation", with internal files under "implementation/internal". Made `IRBlockConstruction` just a nested module of `IRConstruction`/`SSAConstruction`, so it gets picked up from the `Construction` parameter of the `IR` module, rather than being picked up just from being in the same directory as `IRBlock`.
2018-09-04 09:05:27 -07:00
Dave Bartolomeo
aa4436fa22 C++: More IR reshuffling
Remove redundant "_ir" suffix.
Move non-user-importable modules into "implementation" directory.
2018-09-04 09:05:21 -07:00
Dave Bartolomeo
97cfbd9488 C++: "IR" means "Aliased SSA IR"
This change makes the public IR.qll module resolve to the flavor of the IR that we want queries to use. Today, this is the aliased SSA flavor of the IR. Should we add additional IR iterations in the future, we'll update IR.qll to resolve to whichever one we consider the default.

I moved the PrintIR.ql and IRSanity.ql queries into the internal directories of the corresponding flavors. There's still a PrintIR.ql and an IRSanity.ql in the public IR directory, which use the same IR flavor as the public IR.qll.
2018-09-04 09:05:15 -07:00
Dave Bartolomeo
aacee8fecf C++: Reshuffle IR files into a consistent directory structure
There are no real code changes here, other than to fix up `import`s. All tests still hae the same output, as expected.

A future commit will hide the IR flavors other than the one we want queries to use directly.
2018-09-04 09:05:03 -07:00
Jonas Jensen
9535f83d3a Revert "Revert "C++: update expected sizes of error and unknown types to be 1 byte""
This commit was reverted on `master` but should remain on `next`, so I'm
reverting the revert before merging `master` into `next`.

This reverts commit adda4c91cf.
2018-09-04 16:10:46 +02:00
Nick Rolfe
f2d030a7e6 C++: shorten message in integer-multiplication-cast-to-long 2018-09-04 14:45:12 +01:00
Jonas Jensen
adda4c91cf Revert "C++: update expected sizes of error and unknown types to be 1 byte"
This commit to update test changes got merged to Semmle/ql master but
doesn't belong there because it's not compatible with how the 1.18
extractor works. The corresponding extractor change got merged to the
internal-repo master right after the internal branch for 1.18 was taken.

This reverts commit d4f9b5eb52.
2018-09-04 13:45:08 +02:00
Ian Lynagh
3fd6a8de7d C++: Fix the definition of GlobalNamespace.getADeclaration()
Globals can still have declarations in declaration statements.
We already rule out local variables etc via the isTopLevel check,
so we don't need to consider DeclStmt.
2018-09-04 11:37:10 +01:00
Ian Lynagh
1fcf156e7e C++: Add another test to namespaces test 2018-09-04 11:36:50 +01:00
Ian Lynagh
e39a0d2f72 C++: Tweak namespaces test 2018-09-04 11:36:09 +01:00
Jonas Jensen
6e9cc46e80 Merge pull request #131 from ian-semmle/namespace_vars
C++: Give namespace variables a qualified name
2018-09-04 08:56:01 +02:00
Nick Rolfe
04e919df9d C++: clearer alert wording in integer-multiplication-cast-to-long 2018-09-03 16:56:56 +01:00
Ian Lynagh
3a00e24e89 C++: Give NamespaceVariables a qualified name 2018-08-31 16:39:21 +01:00
Ian Lynagh
d7d8186bbe C++: Improve namespaces/namespaces test 2018-08-31 16:37:59 +01:00
Nick Rolfe
d4f9b5eb52 C++: update expected sizes of error and unknown types to be 1 byte 2018-08-31 12:08:15 +01:00
Nick Rolfe
d8d3bfd857 C++: expand aggregate literals test to cover ordering of child exprs 2018-08-30 22:42:30 +01:00
Nick Rolfe
afa7505cae C++: expand test for aggregate literals to include more nesting 2018-08-30 22:42:30 +01:00
Nick Rolfe
4abdeda857 C++: update test output to match corrected extractor behaviour 2018-08-30 22:42:30 +01:00
semmle-qlci
d957c151a6 Merge pull request #110 from jbj/fewer-dbtypes
Approved by ian-semmle
2018-08-29 17:26:06 +01:00
ian-semmle
1d202dd7cd Merge pull request #24 from nickrolfe/declspec_guard
C++: test for __declspec(guard(...))
2018-08-28 16:15:08 +01:00
Jonas Jensen
38fe45ef32 C++: Don't use dbtypes in Declaration.qll 2018-08-28 14:58:39 +02:00
Jonas Jensen
854d0db552 C++: Don't use dbtypes in ClassesWithManyFields.ql
This changes the test output because `VariableDeclarationGroup.toString`
changes to be the one inherited from VariableDeclarationEntry. This
should not affect the output as shown by any front end because
the string to be displayed to the user for a `$@` interpolation comes
from the following column instead.
2018-08-28 14:58:39 +02:00
Jonas Jensen
f005d45c63 C++: Change SuppressionScope.toString
This should have no effect in itself but changes the test output to
correspond with the change coming next.
2018-08-28 14:58:39 +02:00
Jonas Jensen
367776511f C++: Don't use dbtypes in ControlFlowNode etc.
Many classes have been declared with `extends @cfgnode` because they
should be implemented internally as a control-flow node but should not
expose the member predicates of `ControlFlowNode` to their users. After
the transition in a1e44041e it became mandatory to convert explicitly
between the `Element`-derived `ControlFlowNode` and the raw dbtype
`@cfgnode`, and that commit inserted numerous such conversions as a
result of having all those classes that did not derive from `Element` in
the standard library.

It was also confusing and error-prone that the libraries implementing
`ControlFlowNode` referred to `ControlFlowNode`. This seemingly cyclic
reference worked out because the libraries did not call the predicates
on `ControlFlowNode` whose implementation they were part of.

Both these problems are now solved by adding a new class
`ControlFlowNodeBase extends Element` that should be used in preference
to `@cfgnode` everywhere. This class is for exactly those use cases
where `@cfgnode` should be seen as an `Element` without having too many
member predicates on it.

The classes that move from extending `@cfgnode` to extending
`ControlFlowNodeBase` are: `BasicBlock`, `AdditionalControlFlowEdge`,
`DefOrUse`, `SsaDefinition`, `SubBasicBlock` and `RangeSsaDefinition`.
These previously had to define their own `toString` rootdef, which
typically had some dummy string as result (like `"BasicBlock"`), but now
their `toString` is part of the `Element` rootdef and should not be
overridden otherwise `Element.toString` will sometimes have multiple
results. Removing these dummy `toString` predicates had some effects on
the tests that are included in this commit.

The `getLocation` family of predicates is affected like `toString`, but
the situation is slightly different. Some of these classes had genuinely
useful alternative definitions of locations. Fortunately, they all used
`hasLocationInfo`, which is preferred over `getLocation` by the QL
engine. Because `Element` does not define `getLocationInfo`, each class
can create its own rootdef of this predicate like before.
2018-08-28 14:27:32 +02:00