Commit Graph

7095 Commits

Author SHA1 Message Date
Geoffrey White
beada95014 CPP: Examples Block.qll. 2019-08-12 15:08:37 +01:00
Jonas Jensen
3f531380d1 C++: Reduce number of SubBasicBlocks in FlowVar
by cutting basic blocks at the same place for the `x.a` partial
definition in `x.a = ...` as they were already cut for assignment to
`a`.
2019-08-12 15:58:35 +02:00
Dave Bartolomeo
19d2f3a54e Merge pull request #1550 from jbj/array-aggregate-perf
C++ IR: Fix performance of large value-initialized arrays
2019-08-12 06:53:16 -07:00
Geoffrey White
2d2890e401 CPP: Add examples Parameter.qll. 2019-08-12 13:29:07 +01:00
Geoffrey White
ceec0278e5 CPP: Add examples Initializer.qll. 2019-08-12 13:16:34 +01:00
Max Schaefer
eb8087f4ea Java/C++/C#: Provide path-node locations via hasLocationInfo, not getLocation. 2019-08-12 12:52:30 +01:00
Jonas Jensen
0652d2a92b Merge pull request #1705 from geoffw0/qldoceg2
CPP: Add syntax examples to QLDoc in Enum.qll.
2019-08-12 13:39:05 +02:00
Jonas Jensen
5724fb0df0 Merge pull request #1706 from geoffw0/qldoceg3
CPP: Add syntax examples to QLDoc in Struct.qll, Union.qll.
2019-08-12 07:57:40 +02:00
Geoffrey White
208f533245 CPP: Brace placement. 2019-08-09 17:48:57 +01:00
Geoffrey White
11d17b891e CPP: Brace placement. 2019-08-09 17:44:55 +01:00
Geoffrey White
e149b6a332 CPP: Brace placement. 2019-08-09 17:42:02 +01:00
Jonas Jensen
0507d51f0c C++: Prune getAReachedBlockVarSBB using live vars
On a Postgres snapshot, where the `getAReachedBlockVarSBB` predicate
performs badly because of a Yacc-generated 20,000-line parser loop, that
predicate is reduced from 4m22s to 1m32s plus 5.2s for the live
variables analysis.

This change removes 17,142 rows from `BlockVar.getAnAccess` on Postgres.
I sampled some of them, and they were all of the following form:

    while (...) {
      T x;
      f1(&x); // access
      f2(&x); // definition
    }

Such accesses are ruled out now because we deliberately lose track of
variables when they go out of scope.
2019-08-09 16:06:28 +02:00
Jonas Jensen
8aa24fe5c9 C++: Improve QLDoc on assignmentLikeOperation 2019-08-09 15:06:19 +02:00
Geoffrey White
1173daefca CPP: Minor changes. 2019-08-08 17:55:50 +01:00
Geoffrey White
950bc6e3d0 CPP: Brace placement. 2019-08-08 17:51:27 +01:00
Geoffrey White
c406746190 CPP: Brace placement. 2019-08-08 17:16:47 +01:00
Geoffrey White
5bdaefd504 CPP: Brace placement. 2019-08-08 17:13:58 +01:00
Geoffrey White
f0e6730eba Update cpp/ql/src/semmle/code/cpp/Union.qll
Co-Authored-By: Jonas Jensen <jbj@knef.dk>
2019-08-08 17:11:05 +01:00
Geoffrey White
a1cf7b50a9 Update cpp/ql/src/semmle/code/cpp/Struct.qll
Co-Authored-By: Jonas Jensen <jbj@knef.dk>
2019-08-08 17:10:52 +01:00
Geoffrey White
7086004f8a Update cpp/ql/src/semmle/code/cpp/Union.qll
Co-Authored-By: Jonas Jensen <jbj@knef.dk>
2019-08-08 17:06:44 +01:00
Geoffrey White
b3bcc33bce Update cpp/ql/src/semmle/code/cpp/Struct.qll
Co-Authored-By: Jonas Jensen <jbj@knef.dk>
2019-08-08 17:06:17 +01:00
Geoffrey White
be25338e44 CPP: QLDoc Function.qll. 2019-08-08 15:02:55 +01:00
Jonas Jensen
2c6dbacd2b C++: Tidy up DataFlowUtil.qll 2019-08-08 14:05:03 +02:00
Jonas Jensen
0a13d7a337 C++: PartialDefNode -> PartialDefinitionNode 2019-08-08 14:05:03 +02:00
Jonas Jensen
98d6f3cada C++: Unify partial def and def-by-ref
This removes a lot of flow steps, but it all seems to be flow that was
present twice: both exiting a `PartialDefNode` and a
`DefinitionByReferenceNode`. All `DefinitionByReferenceNode`s are now
`PartialDefNode`s.
2019-08-08 14:05:03 +02:00
Jonas Jensen
5370e7d693 C++: Remove TThisVar
There's no need to model `this` as a variable because it's never
reassigned.
2019-08-08 14:05:03 +02:00
Jonas Jensen
861964337c C++: Undo autoformat of FlowVar.qll
The formatting changes were good, but were tangled in with other
changes, making it hard to review this file.
2019-08-08 14:05:03 +02:00
Pavel Avgustinov
835e495e7c Remove unused args 2019-08-08 14:05:03 +02:00
Pavel Avgustinov
dccc0f4db1 Add handling of post-constructor-call nodes 2019-08-08 14:05:03 +02:00
Pavel Avgustinov
9e6c240ee2 Override getFunction on PostUpdateNodes 2019-08-08 14:05:03 +02:00
Pavel Avgustinov
abcaeded23 Only split BBs for var-defining partial-defs 2019-08-08 14:05:03 +02:00
Pavel Avgustinov
46e6b587bc Exclude partial defs from ordinary SSA handling 2019-08-08 14:05:03 +02:00
Pavel Avgustinov
5fbe982084 Add missing getType override 2019-08-08 14:05:03 +02:00
Pavel Avgustinov
1b9a2d3d87 Reduce partial definition flow edge redundancy 2019-08-08 14:05:02 +02:00
Pavel Avgustinov
bb8eb235e0 Handle constructor call qualifiers 2019-08-08 14:05:02 +02:00
Pavel Avgustinov
66164eb06f Propagate data flow through NewExprs 2019-08-08 14:05:02 +02:00
Pavel Avgustinov
623652247d Introduce partial-definition nodes 2019-08-08 14:05:02 +02:00
Pavel Avgustinov
15b56d93bd No implicit instances for constructor call 2019-08-08 14:05:02 +02:00
Pavel Avgustinov
04454ef184 Begin extending dataflow node model for field flow (and other stuff) 2019-08-08 14:05:02 +02:00
Jonas Jensen
3b2ef44195 Merge pull request #1710 from geoffw0/oddsandends
CPP: Delete invalid URL
2019-08-07 15:02:37 +02:00
Geoffrey White
d1093cae2e CPP: Delete invalid URL and strange comment. 2019-08-07 09:25:36 +01:00
yh-semmle
033879f5a6 Merge pull request #1639 from aschackmull/java/in-out-barriers
Java/C++/C# DataFlow: Add support for in/out barriers on sources and sinks.
2019-08-07 01:07:19 -04:00
Jonas Jensen
077f372f98 Merge pull request #1570 from geoffw0/qldoceg
CPP: Add syntax examples to QLDoc in Class.qll.
2019-08-06 21:17:45 +02:00
zlaski-semmle
3ad0bcf3de Merge pull request #1701 from Semmle/geoffw0-patch-1
CPP: QLDoc tidy up Declaration.qll
2019-08-06 11:53:20 -07:00
Geoffrey White
33d38ac090 CPP: QLDoc Enum.qll. 2019-08-06 15:38:10 +01:00
Geoffrey White
5d4fba4446 CPP: QLDoc examples in Struct.qll and Union.qll. 2019-08-06 15:36:38 +01:00
Nick Rolfe
257daddf3b Merge pull request #1702 from mgrettondann/cpp-add-thread_local-support-external
C++: add thread_local support
2019-08-06 14:51:27 +01:00
Jonas Jensen
b4b940ae50 C++ IR: Remove unused predicate 2019-08-06 14:50:59 +02:00
Jonas Jensen
aab6c072c7 C++ IR: Remove fields from InstructionTag
Like array indexes were seemingly not needed in instruction tags, the
same appears to apply to fields.
2019-08-06 14:50:59 +02:00
Jonas Jensen
d378da33e8 C++ IR: Fix performance of large array value init
There were two problems here.

1. The inline predicates `isInitialized` and `isValueInitialized` on
   `ArrayAggregateLiteral` caused their callers to materialize every
   `int` that was a valid index into the array. This was slow on huge
   value-initialized arrays.
2. The `isInitialized` predicate was used in the `TInstructionTag` IPA
   type, creating a numbered tuple for each integer in it. This seemed
   to be entirely unnecessary since the `TranslatedElement`s using those
   tags were already indexed appropriately.
2019-08-06 14:50:57 +02:00