Commit Graph

41418 Commits

Author SHA1 Message Date
AndreiDiaconu1
3a5140c0f5 Indexers and events
Added test for indexers.
Added support for event accesses and added test.
2019-09-26 11:46:16 +01:00
AndreiDiaconu1
16d8d2efa1 Remove useless translation 2019-09-26 11:46:16 +01:00
shati-patel
d4fa14a177 Merge pull request #2030 from jf205/python-docs-fixes
Learn QL: QL for Python doc fixes for 1.22
2019-09-26 10:54:21 +01:00
Rasmus Wriedt Larsen
94d876e8a3 Learn QL: Fix query link in Python Points-to tutorial
(cherry picked from commit c6c565bc37)
2019-09-26 10:44:29 +01:00
Rasmus Wriedt Larsen
9511465f04 Learn QL: Minor formatting fix in python/statements-expressions
(cherry picked from commit c47a4e0c44)
2019-09-26 10:44:29 +01:00
jf205
47a094239c Merge pull request #2028 from RasmusWL/learnql-fix-formatting
Learn QL: Minor formatting fix in python/statements-expressions
2019-09-26 10:34:31 +01:00
Asger F
c2f6855a7b JS: Update tests 2019-09-26 10:17:58 +01:00
Asger F
cafa9edf69 JS: upgrade script, stats, version string 2019-09-26 10:17:58 +01:00
Asger F
b4f67f20af JS: Extract types and signatures for functions 2019-09-26 10:17:58 +01:00
Asger F
999d10e1f0 JS: Use consistent indentation 2019-09-26 10:17:58 +01:00
Asger F
405d43d539 JS: Merge CallSignatureTypes test 2019-09-26 10:17:58 +01:00
Asger F
97494290de JS: Add getOverloadIndex() 2019-09-26 10:17:58 +01:00
Asger F
8ca294ae41 JS: Merge TypeScript/CallSignatures test 2019-09-26 10:17:58 +01:00
Rasmus Wriedt Larsen
c47a4e0c44 Learn QL: Minor formatting fix in python/statements-expressions 2019-09-26 11:16:24 +02:00
Taus
3f3b0e5149 Merge pull request #2013 from RasmusWL/python-random-bag
Python: small improvements
2019-09-26 11:08:36 +02:00
jf205
af1bfb2f7e Merge pull request #2025 from RasmusWL/python-fix-example-link
Learn QL: Fix query link in Python Points-to tutorial
2019-09-26 08:26:13 +01:00
Tom Hvitved
7f18f35f31 C#: Update test 2019-09-25 21:20:45 +02:00
Rasmus Wriedt Larsen
c6c565bc37 Learn QL: Fix query link in Python Points-to tutorial 2019-09-25 18:20:48 +02:00
Tom Hvitved
3da438bb84 C#: Handle unbound types in conversion library
A constructed type, `C<T>`, where `T` is the type parameter of `C`, is represented
in the database as the corresponding unbound generict type `C<>`. Consequently, the
type conversion library, which only considers `ConstructedType`s, does not handle
all implicit conversions. For example, in

```
interface I<in T1, T2> where T1 : C
```

there should be an implicit conversion from `I<C, T2>` to `I<T1, T2>` (=`I<>`).
2019-09-25 16:24:38 +02:00
Shati Patel
886b258385 QL etudes: Update linked queries 2019-09-25 14:35:25 +01:00
Tom Hvitved
c810776413 C#: Update reference conversion test 2019-09-25 15:14:21 +02:00
Shati Patel
0b0f69fe2d QL etudes: Tidy up alternative solns 2019-09-25 12:50:05 +01:00
semmle-qlci
24240177c5 Merge pull request #2023 from ian-semmle/agglit
Approved by jbj
2019-09-25 11:35:33 +01:00
Tom Hvitved
5a198a39df C#: Autoformat 2019-09-25 11:52:19 +02:00
Ian Lynagh
142e1cb9fb C++: Implement AggregateLiteral.mayBeImpure() 2019-09-25 10:34:30 +01:00
Anders Schack-Mulligen
7c1594df13 Java: Slight precision improvement for getter/setter detection. 2019-09-25 10:14:49 +02:00
Tom Hvitved
afdb788333 C#: Refactor cs/local-not-disposed using data flow library 2019-09-25 09:33:39 +02:00
Tom Hvitved
665564f809 C#: Add more tests for cs/local-not-disposed 2019-09-25 09:33:39 +02:00
Jonas Jensen
0aafa0b0e2 C++: Accept test changes in IR sanity queries
These looks harmless.
2019-09-25 08:55:55 +02:00
Jonas Jensen
67ae00f0f0 Merge pull request #2019 from zlaski-semmle/zlaski/what-buffer-function
Rename references to `BufferFunction` with `ArrayFunction`
2019-09-25 08:33:01 +02:00
Ziemowit Laski
a6d619cfe1 [zlaski/what-buffer-function] Rename CustomModels to Models 2019-09-24 18:17:34 -07:00
Ziemowit Laski
7e14e2a950 [zlaski/what-buffer-function] Rename references to BufferFunction to ArrayFunction. 2019-09-24 18:02:14 -07:00
Dave Bartolomeo
0e432c2405 Merge pull request #1937 from matt-gretton-dann/cpp-432-namespacembrs-unique-key
C++: Update test for fix to namespace members
2019-09-24 10:11:55 -07:00
Shati Patel
3441696100 Apply suggestions from code review 2019-09-24 17:28:14 +01:00
AndreiDiaconu1
d6e4a2afef Autoformat 2019-09-24 17:26:13 +01:00
Dave Bartolomeo
f5dc8ba3ce Merge pull request #2005 from AndreiDiaconu1/ircsharp-unaliased
C# IR: Unaliased SSA
2019-09-24 09:05:48 -07:00
Rasmus Wriedt Larsen
752615fb56 Python: Fix doc for Expr::isDeletion 2019-09-24 16:56:07 +02:00
Rasmus Wriedt Larsen
f870b21d2f Python: Use Builtin::special for floats ClassValue
We could find no reason for using `Builtin::builtin` instead of
`Builtin::special`. Since all the other base types use `special`, and the old
Object API is using `special`, let's also do that :)
2019-09-24 16:55:49 +02:00
semmle-qlci
0d3edae3fc Merge pull request #2004 from xiemaisi/js/fix-xss-sanitisers
Approved by asger-semmle
2019-09-24 15:44:23 +01:00
Taus
594a50e066 Merge pull request #1955 from RasmusWL/python-modernise-explicit-return-in-init
Python: Modernise the `py/explicit-return-in-init` query.
2019-09-24 16:23:37 +02:00
AndreiDiaconu1
3f4713f0f5 Add tests and query 2019-09-24 14:53:12 +01:00
AndreiDiaconu1
1b47f80a7a C# implementation 2019-09-24 14:53:12 +01:00
AndreiDiaconu1
f25602bf1c Initial, C++ implementation 2019-09-24 14:53:12 +01:00
AndreiDiaconu1
9228cf83fa Address PR comments 2019-09-24 14:49:09 +01:00
Jonas Jensen
b75bf06649 C++: Accept test changes in other IR tests 2019-09-24 13:00:21 +02:00
Ian Lynagh
49276e09c5 C++: Add aggregate literals to sideEffects test 2019-09-24 11:28:57 +01:00
semmle-qlci
18a52c3825 Merge pull request #2006 from felicitymay/1.22/supported-systems
Approved by jf205, xiemaisi
2019-09-24 09:20:25 +01:00
Dave Bartolomeo
300e580874 C++: Implement language-neutral IR type system
The C++ IR currently has a very clunky way of specifying the type of an IR entity (`Instruction`, `Operand`, `IRVariable`, etc.). There are three separate predicates: `getType()`, `isGLValue()`, and `getSize()`. All three are necessary, rather than just having a `getType()` predicate, because some IR entities have types that are not represented via an existing `Type` object in the AST. Examples include the type for an lvalue returned from a `VariableAddress` instruction, the type for an array slice being zero-initialized in a variable initializer, and several others. It is very easy for QL code to just check the `getType()` predicate, while forgetting to use `isGLValue()` to determine if that type is the actual type of the entity (the prvalue case) or the type referred to by a glvalue entity. Furthermore, the C++ type system creates potentially many different `Type` objects for the same underlying type (e.g. typedefs, using declarations, `const`/`volatile` qualifiers, etc.), making it more difficult to tell when two entities have semantically equivalent types.

In addition, other languages for which we want to enable the IR have somewhat different type systems. The various language type systems differ in their structure, although they tend to share the basic building blocks necessary for the IR.

To address all of the above problems, I've introduced a new class hierarchy, rooted at the class `IRType`, that represents a bare-bones type system that is independent of source language (at least across C/C++/C#/Java). A type's identity is based on its kind (signed integer, unsigned integer, floating-point, Boolean, blob, etc.), size and in the case of blob types, a "tag" to differentiate between different classes and structs. No distinction is made between, say `signed int` and plain `int`, or between different language integer types that have the same signedness and size (e.g. `unsigned int` vs. `wchar_t` on Linux). `IRType` is intended for use by language-agnostic IR-based analyses, including range analysis, dataflow, SSA construction, and alias analysis. The set of available `IRType`s is determined by predicate provided by the language library implementation (e.g. `hasSignedIntegerType(int byteSize)`.

In addition to `IRType`, each language now defines a type alias named `LanguageType`, representing the type of an IR entity in more language-specific terms. The only predicate requried on `LanguageType` is `getIRType()`, which returns the single `IRType` object for the language-neutral representation of that `LanguageType`. All other predicates on and subclasses of `LanguageType` are language-specific. There may be many instances of `LanguageType` that map to a given `IRType`, to allow for typedefs, etc.

Most of the changes are mechanical changes in the IR construction code, to return the correct type for each IR entity. SSA construction has also been updated to avoid dependencies on language-specific types.

I have not yet removed the original `getType()` predicates that just return `Type`. These can be removed once we move the remaining existing libraries to use `IRType`.

Test results are, by design, pretty much unchanged. Once case changed for inline asm, because the previously IR generation for it played a little fast and loose with the input/output expressions. The test case now includes both input and output variables. The generated IR for `Conditional_LValue` is now more correct, because we now have a way to represent an lvalue of an lvalue. `syntax-zoo` is still a hot mess. Most of the changed outputs are due to wobble from having multiple functions with the same name, but with a slightly different order of evaluation due to the type changes. Others are wobble from already-invalid IR. A couple non-wobbly places have improved slightly, though.

The C# part of this change is waiting for #2005 to be merged, since that has some of the necessary C# implementation.
2019-09-23 16:14:00 -07:00
Calum Grant
b85896299d Merge pull request #2000 from AndreiDiaconu1/ircsharp-fixes
C# IR: Minor fixes and changes
2019-09-23 18:14:50 +01:00
Felicity Chapman
61b372b062 Add Go to supported languages topic and update release number 2019-09-23 17:52:02 +01:00