Commit Graph

41418 Commits

Author SHA1 Message Date
Jonas Jensen
d66578eaa8 C++: Add IntegerPartial, use in ConstantAnalysis
This adds `IntegerPartial.qll`, which is similar to
`IntegerConstant.qll` except that it contains partial functions on
integers instead of total functions on optional integers. This speeds up
the constant analysis so it takes 6.5s instead of 10.3s on comdb2.
2019-02-05 11:05:47 +01:00
Tom Hvitved
d829d98165 Merge branch 'master' into csharp/autoformat 2019-02-05 10:37:42 +01:00
semmle-qlci
06ae0c421a Merge pull request #864 from jbj/ir-TIRVariable-shared
Approved by dave-bartolomeo
2019-02-05 07:55:28 +00:00
Dave Bartolomeo
dc209246aa Merge pull request #866 from jbj/ir-TInstruction-normalize
C++: Normalize TInstruction
2019-02-04 12:14:45 -08:00
semmle-qlci
f47a77b442 Merge pull request #875 from hvitved/csharp/accessor-call-revert
Approved by calumgrant
2019-02-04 19:27:38 +00:00
Dave Bartolomeo
aadd5cf202 Merge pull request #863 from jbj/ir-variableLiveOnEntryToBlock-rhs
C++: Speed up variableLiveOnEntryToBlock in IR
2019-02-04 10:47:29 -08:00
Jonas Jensen
3735cb69ce C++: No InstructionTag in SSAConstruction
This does to `SSAConstruction` what the previous commit did to
`IRConstruction`. An instruction in `SSAConstruction` is now defined in
terms of how it was created rather than what it can be queried for.
Effectively, this defines `TInstruction` as `TInstructionTag` was
defined before and then removes `TInstructionTag` from
`SSAConstruction`. This also has the benefit of removing the concept of
an instruction tag from the public predicates on `Instruction`.
2019-02-04 19:43:17 +01:00
Jonas Jensen
8ae3551ec1 C++: Normalize TInstruction in raw IR
This definition was denormalized to the extent that an instruction was
defined in terms of the six main attributes it could be queried for.
This made it possible to do multi-column joins on those six attributes,
but it doesn't appear that this feature was useful in practice. The main
multi-column join that was in use was on the pair of
(`TranslatedElement, InstructionTag`), but the `TranslatedElement` was
not part of the `TInstruction`.

This commit changes `TInstruction` to be defined in terms of what it's
_built from_ (`TranslatedElement, InstructionTag`) instead. This makes
it possible to do multi-column joins on those two components, and then
there are separate predicates (usually with two columns) to query
instruction attributes, replacing the many uncached projections from
`MkInstruction` that were generated before.

An immediate advantage is that an `Expr` with multiple types will no
longer give rise to multiple `Instruction`s, fixing most of the errors
from the sanity query `ambiguousSuccessors`. The code inside
`IRConstruction.qll` becomes simpler and hopefully faster as there is no
longer a translation from `TranslatedElement` to `Locatable` and back
again.
2019-02-04 19:43:17 +01:00
Jonas Jensen
3e03835630 C++: Only create variables in FunctionIRs
The previous commit had the side effect that `IRVariable`s were created
for all `Functions`, including those that did not have IR. This commit
restricts all `TIRVariable` constructors to functions that have IR.
2019-02-04 19:34:16 +01:00
Taus Brock-Nannestad
895b237e3c Python: Make "Modification of parameter with default" flow-sensitive. 2019-02-04 19:05:04 +01:00
Dave Bartolomeo
6d3d9025f7 Merge pull request #867 from jbj/ir-ignoreExprAndDescendants-perf
C++: Replace FastTC with iteration in ignoreExpr
2019-02-04 09:26:32 -08:00
Dave Bartolomeo
7345c921d9 Merge pull request #857 from jbj/ir-getInstruction
C++: Fix TranslatedElement.getInstruction perf
2019-02-04 09:24:00 -08:00
Robert Marsh
411c285aa3 Merge pull request #870 from jbj/ir-shortestDistances
C++: Use shortestDistances HOP for IR BB indexes
2019-02-04 09:19:15 -08:00
Robert Marsh
3a092faebf Merge pull request #865 from p-snft/large-parameter-const-reference
Fix reccomendation for LargeParameter (C++)
2019-02-04 09:18:03 -08:00
Tom Hvitved
13503d068c C#: Use matchesHandle() instead of getLabel() 2019-02-04 16:20:47 +01:00
Asger F
79b9784b08 JS: handle ES2015 modules compiling to Node.js modules 2019-02-04 14:26:24 +00:00
Asger F
5e10e955ee JS: update trivial TRAP changes 2019-02-04 14:25:05 +00:00
Asger F
4b32d8c63f JS: refactor SourceType/Platform 2019-02-04 14:24:39 +00:00
Asger F
ac6b9d1282 JS: add TRAP test with closure modules 2019-02-04 14:24:39 +00:00
Asger F
cac09cf154 JS: Update TRAP output 2019-02-04 14:24:39 +00:00
Asger F
be105b6348 JS: add dbscheme upgrade script 2019-02-04 14:21:34 +00:00
Asger F
8f3b0f584a JS: Extract predicates for ES2015/closure modules 2019-02-04 14:21:34 +00:00
Asger F
51fe31d049 JS: fix FPs in DeadStoreOfLocal 2019-02-04 14:21:34 +00:00
Asger F
6a451a6b53 JS: Fix InvalidExport.ql 2019-02-04 14:21:34 +00:00
Asger F
72fe63074a JS: convert tabs to spaces 2019-02-04 14:21:34 +00:00
Asger F
df88534b36 JS: use PropWrite in exports() predicate 2019-02-04 14:21:34 +00:00
Asger F
c707935841 JS: add Closure::moduleImport and Closure::moduleMember 2019-02-04 14:21:34 +00:00
Asger F
82c0756248 JS: autoformat 2019-02-04 14:21:34 +00:00
Asger F
2ae926462c JS: Move closure code into a module 2019-02-04 14:21:34 +00:00
Asger F
6bcae5e7c2 JS: address comments 2019-02-04 14:21:34 +00:00
Asger F
9fd4e81f20 JS: add change note 2019-02-04 14:21:34 +00:00
Asger F
6a63c3f149 JS: raise precision of global accesses 2019-02-04 14:21:34 +00:00
Asger F
9589ccd40d JS: support imports/exports for closure library code 2019-02-04 14:21:34 +00:00
Asger F
30ba7aedfe JS: split SourceType.MODULE into two 2019-02-04 14:21:34 +00:00
Asger F
f00b16e500 JS: recognize Closure modules files as modules 2019-02-04 14:21:34 +00:00
Tom Hvitved
b4b6fdd12b C#: Revert recent change to AccessorCall
The recent change to `AccessorCall` on dd99525566 resulted
in some bad join-orders, so I have (partly) reverted them. This means that the issues
orignally addressed by that change are now reintroduced, and I plan to instead apply a
fix to the CFG, which--unlike the original fix--should be able to handle multi-property-tuple
assignments.
2019-02-04 15:14:18 +01:00
calum
d79201ec47 C#: Change notes. 2019-02-04 12:53:18 +00:00
calum
7d17724cae C#: The empty string is not considered a format string for this query. 2019-02-04 12:53:12 +00:00
calum
eb0036172e C#: Add test for false-positive. 2019-02-04 12:30:43 +00:00
Jonas Jensen
45a995ba52 C++: Accept test changes from last commit 2019-02-04 13:00:28 +01:00
calum
f8870e78e7 C#: Fix test. 2019-02-04 11:51:04 +00:00
semmle-qlci
e195ac996e Merge pull request #868 from xiemaisi/js/discard-tokens-early
Approved by esben-semmle
2019-02-04 11:32:03 +00:00
Taus
32cc7c7cd9 Merge pull request #858 from markshannon/python-a-few-more-unknowns
Python: Slight improvement to reachability in points-to
2019-02-04 12:14:50 +01:00
Nick Rolfe
fa07364214 Vim syntax highlighting and file-type detection 2019-02-04 10:48:32 +00:00
Jonas Jensen
8368c37781 C++: Use shortestDistances HOP for IR BB indexes
This doesn't make it much faster, but it reduces the debug output
volume. It also simplifies the code.

I've found this change necessary when I compute the full IR on a
Wireshark snapshot in QL4E. Without it, Eclipse runs out of memory
because the console log is too large.
2019-02-04 11:40:11 +01:00
Tom Hvitved
910995af90 C#: Autoformat QL code 2019-02-04 10:32:30 +01:00
Max Schaefer
7be3336aaf JavaScript: Document per-function caches in CFG extractor. 2019-02-04 08:17:21 +00:00
Max Schaefer
6ad45b2451 JavaScript: Temporarily remove unstable test. 2019-02-04 08:10:39 +00:00
Jonas Jensen
60141bf317 C++: ignoreExprAndDescendants QL-796 workaround
The new predicate `isOrphan` gets inlined into
`ignoreExprAndDescendants`, whose performance improves from

    TranslatedElement::ignoreExprAndDescendants#f .. 23.4s (executed 9 times)

to

    TranslatedElement::ignoreExprAndDescendants#f ... 4.3s (executed 9 times)

This dramatic improvement is not only due to eliminating a type check in
the recursive case. Removing the type check from the other base cases
also enabled them to get better join orders.
2019-02-03 16:55:12 +01:00
Jonas Jensen
66e7c26d4e C++: Replace FastTC with iteration in ignoreExpr
Before, `ignoreExprAndDescendants` and its related predicates had this
timing on Wireshark.

    #TranslatedElement::getRealParent#ffPlus#swapped ......... 25.7s
    TranslatedElement::ignoreExprAndDescendants#f ............ 16.9s
    TranslatedElement::getRealParent#ff ...................... 7.2s
    TranslatedElement::ignoreExpr#f .......................... 4.8s
    TranslatedElement::ignoreExpr#f#antijoin_rhs ............. 3.2s
    TranslatedElement::getRealParent#ff_10#higher_order_body . 2.2s

After, it looks like this

    TranslatedElement::ignoreExprAndDescendants#f ............ 23.4s (executed 9 times)
    TranslatedElement::getRealParent#ff ...................... 6.3s
    TranslatedElement::ignoreExpr#f#antijoin_rhs ............. 4.8s
    TranslatedElement::ignoreExpr#f .......................... 3.7s
    TranslatedElement::getRealParent#ff_10#join_rhs .......... 2.5s
    project#TranslatedElement::getRealParent#ff .............. 1.3s
2019-02-03 16:55:12 +01:00