Commit Graph

12966 Commits

Author SHA1 Message Date
Robert Marsh
8c9c316e1b C++: performance and termination fixes 2019-01-08 09:34:27 -08:00
Robert Marsh
567eee1114 C++: allow phi nodes to self-bound 2019-01-08 09:34:27 -08:00
Robert Marsh
b2cd9a29f2 C++: add test for false comparisons 2019-01-08 09:34:26 -08:00
Robert Marsh
2f8ca8802b C++: switch to using ValueNumbers as bounds
This reduces the number of bounds computed, and will simplify use of the
library. The resulting locations in the tests may be slightly strange,
because the example `Instruction` for a `ValueNumber` is the first
appearing in the IR, regardless of source order, and may not be the most
closely related `Instruction` to the bounded value. I think that's worth
doing for the performance and usability benefits.
2019-01-08 09:34:26 -08:00
Robert Marsh
89148a9ec7 C++: respond to further PR comments 2019-01-08 09:34:26 -08:00
Robert Marsh
ae4ffd9166 C++: respond to PR comments, add some TODOs 2019-01-08 09:34:25 -08:00
Robert Marsh
fe32aea31f C++: fix/add comments 2019-01-08 09:34:25 -08:00
Robert Marsh
ed68f9150a C++: Initial implementation of new range analysis 2019-01-08 09:34:23 -08:00
Robert Marsh
a06a20dbab C++: move SimpleRangeAnalysis tests 2019-01-08 09:34:23 -08:00
Jonas Jensen
1be91b5df5 C++: Use IPA for Pos and Spec
This is cleaner than extending `int` and working with magic numbers.
Performance appears to be unaffected.
2019-01-08 16:23:11 +01:00
Jonas Jensen
dba3351d2c C++: Update comments based on PR feedback 2019-01-08 13:29:03 +01:00
Raul Garcia
18bb6696e0 Fixing conditional only issue.
I changed  to detect any logical operation usage (i.e. !, ==), but I kept usage in a conditional directly as a separate detection condition. I found no false positives on the projects you shared with me previously.
2019-01-07 10:44:11 -08:00
Raul Garcia
880306c621 Removing duplicated results 2019-01-04 10:45:43 -08:00
Jonas Jensen
26f32f0d6d C++: Initial version of CFG.qll
This implements calculation of the control-flow graph in QL. The new
code is not enabled yet as we'll need more extractor changes first.

The `SyntheticDestructorCalls.qll` file is a temporary solution that can
be removed when the extractor produces this information directly.
2019-01-04 13:34:36 +01:00
Max Schaefer
b4f400fb23 Merge remote-tracking branch 'upstream/next' into qlucie/master 2019-01-04 10:35:57 +00:00
Jonas Jensen
a47faa2272 C++: Add ConditionDeclExpr convenience predicates
Also expand the QLDoc.
2019-01-04 10:24:08 +01:00
Jonas Jensen
ca0517b3d6 C++: LocalVariable docs 2019-01-04 10:24:08 +01:00
Jonas Jensen
8f9849b30b C++: Add BuiltInIntAddr class for __INTADDR__ 2019-01-04 10:24:08 +01:00
Jonas Jensen
79e246f961 Merge pull request #722 from geoffw0/doc-macroinv
CPP: Improve qldoc for MacroAccess and MacroInvocation.
2019-01-04 08:40:37 +01:00
Ian Lynagh
187fdf67b0 C++: Rename twoOperand to isTwoOperand 2019-01-03 21:09:49 +00:00
Ian Lynagh
98e8858dc6 C++: Accept test changes 2019-01-03 21:09:49 +00:00
Ian Lynagh
283eb51db8 C++: Update stats after adding expr_cond* tables 2019-01-03 21:09:49 +00:00
Ian Lynagh
dc3d87f2fc C++: Add tables for ConditionalExprs 2019-01-03 21:09:49 +00:00
Raul Garcia
89c045b550 Merge branch 'users/raulga/c6324' of https://github.com/raulgarciamsft/ql into users/raulga/c6324 2019-01-03 10:06:59 -08:00
Raul Garcia
2c1d7bbc41 Switched to DataFlow::localFlow to avoid false positives. 2019-01-03 10:06:49 -08:00
Geoffrey White
787febae6e CPP: Improve qldoc for MacroAccess and MacroInvocation. 2019-01-03 15:16:47 +00:00
Jonas Jensen
b17fb86961 C++: Factor out reachable base case 2019-01-03 11:20:18 +01:00
Raul Garcia
e7bc3e6c0d Update UsingStrcpyAsBoolean.cpp 2019-01-02 17:33:28 -08:00
Raul Garcia
28932e85d9 Fixing the code based on PR feedback. 2019-01-02 16:23:19 -08:00
Jonas Jensen
d566141273 Merge pull request #694 from dave-bartolomeo/dave/BetterUnreached
C++: Remove infeasible edges to reachable blocks
2018-12-21 07:36:51 +00:00
Dave Bartolomeo
a7cb2d6d7c C++: Ignore Unreached blocks in IR Guards 2018-12-20 11:57:25 -08:00
Dave Bartolomeo
63a2670fcd C++: Don't have ReachableBlock extends IRBlock 2018-12-17 13:10:53 -08:00
Dave Bartolomeo
fda8605aae C++: One Unreached per function 2018-12-17 11:03:15 -08:00
alexet
d61022ffcc C++: Improve optimiser performance 2018-12-17 16:11:23 +00:00
Jonas Jensen
5ac5aa0c2a Merge remote-tracking branch 'upstream/master' into mergeback-20181217 2018-12-17 13:42:45 +01:00
Raul Garcia
f8ab945b91 Merge branch 'master' into users/raulga/c6324 2018-12-14 15:46:38 -08:00
Raul Garcia
16f2bacf4d cpp - Using the return value of a strcpy or related string copy function in an if statement 2018-12-14 15:42:49 -08:00
Dave Bartolomeo
56bb9dcde0 C++: Remove infeasible edges to reachable blocks
The existing unreachable IR removal code only retargeted an infeasible edge to an `Unreached` instruction if the successor of the edge was an unreachable block. This is too conservative, because it doesn't remove an infeasible edge that targets a block that is still reachable via other paths. The trivial example of this is `do { } while (false);`, where the back edge is infeasible, but the body block is still reachable from the loop entry.

This change retargets all infeasible edges to `Unreached` instructions, regardless of the reachability of the successor block.
2018-12-14 12:13:22 -08:00
Jonas Jensen
23a2bf1756 C++: Delete dead code with warnings in it 2018-12-14 10:59:41 +00:00
Aditya Sharad
f71e5ac338 Merge master into next. 2018-12-13 17:57:31 +00:00
Geoffrey White
b21e832ee2 Merge pull request #683 from jbj/prepareQueries-fix-warnings
C++: Fix all prepareQueries errors and warnings
2018-12-13 15:30:44 +00:00
Aditya Sharad
ce8ca5979b Merge rc/1.19 into next. 2018-12-13 12:23:59 +00:00
Jonas Jensen
bee2ddaf26 C++: Fix all prepareQueries errors and warnings
With these changes we can run `odasa prepareQueries --check-only
--fail-on-warnings` on the C++ query directory. Two changes were needed:

1. The `Metrics/queries.xml` file had to be deleted. It existed because
   the built distribution has a different file layout, where `Metrics`
   is moved to the top-level query dir `odasa-cpp-metrics`. Since
   internal PR 28230 this file is created as needed as part of the dist
   build process, so it doesn't need to be checked in with the sources.
2. All uses of the `deprecated` and stubbed-out Objective C classes were
   removed.
2018-12-13 11:13:50 +00:00
Jonas Jensen
1a0a8c931f C++: Fix name clash in data flow imports
The AST-based data flow libraries and the IR-based ones both define
modules `DataFlow`, `DataFlow2`, etc. This caused
`ImportAdditionalLibraries.ql` to fail in compilation.
2018-12-13 09:53:20 +00:00
Geoffrey White
e443eb8889 CPP: Fix type logic. 2018-12-13 09:49:32 +00:00
Geoffrey White
c904a338f7 CPP: Add test cases. 2018-12-12 23:47:48 +00: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