4315 Commits

Author SHA1 Message Date
Jonas Jensen
e949c167fa C++: Add back getSubBasicBlockStart
It turns out this predicate was used in a test, and that use can't be
replaced with the new `partiallyDefinesVariableAt` predicate since
`partiallyDefinesVariableAt` doesn't hold for a `PartialDefinition` that
defines something other than a variable.
2020-08-27 11:14:47 +02:00
Jonas Jensen
f3e98c3bea C++: Fix join order of FlowVar::definedPartiallyAt
This predicate was very slow on kamailio/kamailio:

    (696s) Tuple counts for FlowVar::FlowVar::definedPartiallyAt_dispred#ff:
    703569     ~3%     {3} r1 = SCAN FlowVar::FlowVar_internal::TBlockVar#fff AS I OUTPUT I.<1>, I.<0>, I.<2>
    7679540588 ~3%     {3} r2 = JOIN r1 WITH FlowVar::PartialDefinitions::PartialDefinition::partiallyDefines_dispred#ff_10#join_rhs AS R ON FIRST 1 OUTPUT R.<1>, r1.<1>, r1.<2>
    567217     ~2%     {2} r3 = JOIN r2 WITH project#FlowVar::PartialDefinitions::PartialDefinition#class#fff#2 AS R ON FIRST 2 OUTPUT r2.<2>, r2.<0>
                       return r3

After this change, the predicate takes no time at all:

    (22s) Tuple counts for FlowVar::FlowVar::definedPartiallyAt_dispred#ff:
    703569  ~3%     {3} r1 = SCAN FlowVar::FlowVar_internal::TBlockVar#fff AS I OUTPUT I.<1>, I.<0>, I.<2>
    567217  ~2%     {2} r2 = JOIN r1 WITH FlowVar::PartialDefinitions::PartialDefinition::partiallyDefinesVariableAt#fff_120#join_rhs AS R ON FIRST 2 OUTPUT r1.<2>, R.<2>
                    return r2

Looking at the code, it turned out that the predicates
`partiallyDefines` and `getSubBasicBlockStart` were almost always used
together and could therefore be merged into a single predicate to get
better join orderings. The predicate `partiallyDefinesThis` was never
used.
2020-08-27 09:52:22 +02:00
Jonas Jensen
2b720b332b C++: Fix join order in reachesWithoutAssignment
The negation in this predicate did not get pulled into an
`#antijoin_rhs` predicate but got materialized as part of each
iteration, which meant that the temporary `ControlFlowNode` column did
not get projected away. The tuple counts looked like this on
kamailio/kamailio (iteration 20):

    5724      ~13%      {3} r9 = JOIN r8 WITH BasicBlocks::Cached::bb_successor_cached#ff@staged_ext AS R ON FIRST 2 OUTPUT r8.<2>, r8.<3>, r8.<1>
    5724      ~12%      {3} r10 = JOIN r8 WITH BasicBlocks::Cached::bb_successor_cached#ff@staged_ext AS R ON FIRST 2 OUTPUT r8.<3>, r8.<2>, r8.<1>
    124717061 ~11%      {4} r11 = JOIN r10 WITH project#FlowVar::FlowVar_internal::assignmentLikeOperation#ffff_10#join_rhs AS R ON FIRST 1 OUTPUT R.<1>, r10.<2>, r10.<1>, r10.<0>
    66        ~0%       {3} r12 = JOIN r11 WITH project#BasicBlocks::Cached::basic_block_member AS R ON FIRST 2 OUTPUT r11.<2>, r11.<3>, r11.<1>
    66                  {3} r13 = MATERIALIZE r12 AS antijoin_rhs
    5658      ~14%      {3} r14 = r9 AND NOT r13(r9.<0>, r9.<1>, r9.<2>)

After manually pulling out the join inside the negation, the time per
iteration drops from ~30 to <1s. The pipeline above is replaced with

    892394  ~0%      {4} r6 = r5 AND NOT FlowVar::FlowVar_internal::assignsToVar#fb AS R(r5.<3>, r5.<2>)
    892394  ~0%      {4} r7 = SCAN r6 OUTPUT r6.<1>, r6.<3>, r6.<0>, r6.<2>
    5658    ~11%     {3} r8 = JOIN r7 WITH BasicBlocks::Cached::bb_successor_cached#ff@staged_ext AS R ON FIRST 2 OUTPUT r7.<2>, r7.<1>, r7.<3>
2020-08-27 09:52:22 +02:00
Jonas Jensen
36373fce9b C++: Deprecate DataFlow::definitionByReferenceNode
This predicate name was only used in IR data flow, not in AST data flow.
2020-08-13 15:27:35 +02:00
Jonas Jensen
3f383784cd C++: QLDoc formatting fixup 2020-08-13 15:27:35 +02:00
Jonas Jensen
f70a17b858 C++: clearer wording in asExpr doc
Co-authored-by: Aditya Sharad <6874315+adityasharad@users.noreply.github.com>
2020-08-13 15:27:35 +02:00
Jonas Jensen
5ae8b02bde C++: Clarify the docs on DataFlow::Node::asExpr
For IR data flow I also added a `definitionByReferenceNodeFromArgument`
predicate to improve compatibility with AST data flow.
2020-08-13 15:27:35 +02:00
Arthur Baars
7e72ef350e Merge pull request #3975 from aibaars/lgtm-suites
CodeQL: complete LGTM suites
2020-07-30 18:39:01 +02:00
Robert Marsh
ddbec50c07 Merge pull request #3990 from MathiasVP/mathiasvp/fix-qldoc-SemanticStackVariable
C++: Fix QLDoc for `SemanticStackVariable`
2020-07-29 12:27:29 -07:00
Arthur Baars
5bad003c0c Add qlpack.yml files for example queries 2020-07-29 16:57:04 +02:00
Mathias Vorreiter Pedersen
978bf3aefc C++: Make QLDoc comment represent a valid C++ template 2020-07-29 15:59:19 +02:00
Arthur Baars
c4041e55ba CodeQL: complete LGTM suites 2020-07-28 20:40:44 +02:00
Mathias Vorreiter Pedersen
a4242bcb5d Merge pull request #3962 from rdmarsh2/ir-barrierguard-checks-expr
C++: make IR BarrierGuard::checks match AST
2020-07-23 09:21:37 +02:00
Robert Marsh
0bb6d0c7ca C++: make IR BarrierGuard::checks match AST 2020-07-17 15:43:57 -07:00
Geoffrey White
2e5af67626 Merge pull request #3952 from MathiasVP/output-parameter-index-for-UserDefinedFormattingFunction
C++: Add getOutputParameterIndex override to UserDefinedFormattingFunction class.
2020-07-15 18:11:09 +01:00
Nick Rolfe
c7b668193b Merge pull request #3929 from igfoo/static_assert
C++: Give static assertions an enclosing element
2020-07-15 18:03:26 +01:00
Mathias Vorreiter Pedersen
289a908eb8 C++: Update qldoc in reponse to PR comments 2020-07-15 16:24:47 +02:00
Mathias Vorreiter Pedersen
c4b97a3a62 C++: Accept more test changes 2020-07-15 16:19:51 +02:00
Mathias Vorreiter Pedersen
edc33b6516 C++: Add getOutputParameterIndex override to UserDefinedFormattingFunction and accept test changes 2020-07-15 14:46:08 +02:00
Mathias Vorreiter Pedersen
d711c22cd2 C++: Add testcase demonstrating lost query results 2020-07-15 14:42:45 +02:00
Mathias Vorreiter Pedersen
174b30461a C++: Fix syntax error in testfile 2020-07-14 19:47:21 +02:00
Mathias Vorreiter Pedersen
834ad92453 C++: Add test cases for unsigned multiplication and fix missing return value in existing tests 2020-07-14 16:57:47 +02:00
Ian Lynagh
616bad7b5c C++: Add an upgrade script 2020-07-14 13:53:46 +01:00
Ian Lynagh
c254de464a C++: Update stats following static_asserts change 2020-07-14 13:53:01 +01:00
Geoffrey White
6519629472 Merge pull request #3942 from MathiasVP/remove-abstract-preprocessor
C++: Remove abstract classes from Preprocessor.qll
2020-07-13 10:00:50 +01:00
Mathias Vorreiter Pedersen
d6da318645 C++: Remove abstract classes from Preprocessor.qll 2020-07-10 21:55:14 +02:00
Dave Bartolomeo
912c50a881 Merge pull request #3937 from MathiasVP/replace-result-type-with-ir-result-type
C++: Replace getResultType() with getResultIRType()
2020-07-10 13:37:30 -04:00
Geoffrey White
456a05ecd5 Merge pull request #3940 from MathiasVP/remove-abstract-stmt
C++: Remove abstract classes and predicates from Stmt.qll
2020-07-10 16:41:45 +01:00
Mathias Vorreiter Pedersen
7cc83da97a C++: Remove @stmt_while from the TConditionalStmt union type. 2020-07-10 15:51:34 +02:00
Geoffrey White
2941f413f9 Merge pull request #3931 from aeisenberg/aeisenberg/cpp-print-ast
Add the printAst.ql contextual query for C++
2020-07-10 14:08:25 +01:00
Mathias Vorreiter Pedersen
567984af3d C++: Remove abstract classes from Stmt.qll 2020-07-10 14:21:56 +02:00
Robert Marsh
05685cc896 Merge pull request #3919 from dbartol/dbartol/IgnoreAutoBuilder
C++: Add `.gitignore` for autobuilder
2020-07-09 15:02:52 -07:00
Andrew Eisenberg
782759d58e Add the printAst.ql contextual query for C++
This query will be used by the VS Code extension for viewing
ASTs of C/C++ files.
2020-07-09 08:28:49 -07:00
Jonas Jensen
2fa54552f0 Merge pull request #3914 from geoffw0/cc_followup
C++: Repair swap taint tests
2020-07-09 15:54:40 +02:00
Mathias Vorreiter Pedersen
85a8280b30 C++: Replace getResultType() with getResultIRType() in IR dataflow 2020-07-09 15:54:15 +02:00
Mathias Vorreiter Pedersen
7029739691 C++: Replace getResultType() with getResultIRType() in IR range analysis 2020-07-09 15:53:54 +02:00
Mathias Vorreiter Pedersen
a405a95b68 C++: Introduce isSigned() and isUnsigned() predicates on IRIntegerType to mirror IntegralType 2020-07-09 15:52:09 +02:00
Jonas Jensen
277185a792 Merge pull request #3925 from geoffw0/rangefixup
C++: Add getFullyConverted() where missing in SimpleRangeAnalysis
2020-07-09 15:45:58 +02:00
Robert Marsh
0e66d0892b Merge pull request #3785 from MathiasVP/dataflow-operand-nodes
C++: Operands as dataflow nodes
2020-07-08 14:50:54 -07:00
Ian Lynagh
71b70b4bd0 C++: Give static_assert's an enclosing element 2020-07-08 17:10:43 +01:00
Jonas Jensen
0bbbfe58cf Merge pull request #3916 from geoffw0/cc_followup2
C++: Add missing constructor taint test
2020-07-08 16:35:47 +02:00
Geoffrey White
61dfebceb9 C++: Add getFullyConverted() as suggested. 2020-07-08 11:28:39 +01:00
Dave Bartolomeo
6f7a8d029c C++: Move .gitignore into autobuilder directory
On second thought, I'm going to make this apply only to the AutoBuilder directory. C# has it in the root of `csharp`, but they need it for their extractor as well.
2020-07-07 16:31:46 -04:00
Dave Bartolomeo
d3bcc1dae4 C++: Add .gitignore for autobuilder
C# has its own additional `.gitignore` to ignore the output files of the AutoBuilder build. Now that we have our own AutoBuilder in C++, we need the same thing.
2020-07-07 16:27:43 -04:00
Geoffrey White
bc7c83a5d6 C++: Add taint test cases confirming that constructor definitions do no need to be present. 2020-07-07 16:01:13 +01:00
Ian Lynagh
22666dd46e Merge pull request #3875 from igfoo/is_constexpr
C++: Accept test changes for is_constexpr
2020-07-07 15:47:28 +01:00
Anders Schack-Mulligen
67db1df00c C++/C#/JavaScript/Python: Port Location qldoc update. 2020-07-07 11:39:27 +02:00
Ian Lynagh
0d9b18dbd7 C++: Accept test changes for is_constexpr
Generated copy and move constructors may now be marked as constexpr.
2020-07-06 19:24:39 +01:00
Geoffrey White
0caa17ab10 C++: Test the new methods. 2020-07-06 18:47:56 +01:00
Geoffrey White
52e501c41d C++: Extend the 'swap' taint tests with methods that do not have recognizable signatures (copy/move assignment). 2020-07-06 18:44:37 +01:00