Commit Graph

101 Commits

Author SHA1 Message Date
Chris Smowton
04c9f60d96 Make up some stats for new expressions, setting canonical constructors as common as records and new expression kinds initially rare 2023-11-30 11:24:00 +00:00
Chris Smowton
20b97af02f Implement dataflow for record patterns
Strategy: there is now a regular flow step from an instance-of LHS / switch expr to the pattern, 0 or more read steps corresponding to record pattern destructors, and then finally a normal SSA def/use step connecting the binding patterns to their first uses.
2023-11-30 11:24:00 +00:00
Chris Smowton
daccd04087 Basic extraction of record patterns 2023-11-30 11:23:59 +00:00
Chris Smowton
54a89d6fef Handle 'case null, default:' 2023-11-30 11:23:59 +00:00
Cornelius Riemenschneider
96edc1d349 Add skeleton bazel files for accessing the dbschemes. 2023-10-05 09:00:38 +02:00
Ian Lynagh
1f538cced3 Kotlin: Handle IrSyntheticBodyKind.ENUM_ENTRIES
Generated by Kotlin 1.9 for some of our tests.
2023-06-19 10:36:29 +01:00
Ian Lynagh
69567449de Java: Update stats 2023-03-30 15:53:34 +01:00
Ian Lynagh
81a26f0396 Java: Add expanded arguments 2023-03-30 15:53:34 +01:00
Chris Smowton
d5f7ef08b7 Update stats 2023-02-14 17:21:24 +00:00
Chris Smowton
3514dd1e4d Java: merge the @class and @interface database types and tables
This will allow the extractor to emit class(id, ...) when all it knows about a class is its name, due to not having it available on the classpath. Previously it would have had to guess whether it belonged to @class or @interface, possibly introducing an inconsistency.
2023-02-14 17:21:23 +00:00
Ian Lynagh
a6b8f4b674 Java/Kotlin: Update stats 2022-11-10 20:29:04 +00:00
Ian Lynagh
d0dfb4926b Kotlin/Java: Add compilation_info table 2022-11-10 20:29:04 +00:00
Tamas Vajk
9eea6d4193 Kotlin: Extract type parameter modifiers (reified, in, out) 2022-10-11 16:40:07 +02:00
Ian Lynagh
5f8d8cdf40 Make *.dbscheme non-executable 2022-08-24 16:37:26 +01:00
Tamas Vajk
e23d36909d Add DB stats file 2022-08-19 14:51:37 +02:00
Tamas Vajk
1c08ac1d7a Kotlin: Identify data classes during extraction 2022-08-19 14:51:36 +02:00
Ian Lynagh
aa07600f5a Java: Update stats 2022-07-11 12:09:48 +01:00
Ian Lynagh
1730ec22d9 Kotlin: Extract an ErrorType if we fail to correctly extract a type 2022-07-01 16:33:43 +01:00
Ian Lynagh
5fc294d49e Kotlin: Record that generated data class members are compiler-generated 2022-06-24 14:00:47 +01:00
Tamas Vajk
053ca2e940 Update DB stats file 2022-06-23 08:45:11 +02:00
Tamas Vajk
dabc956dbf Unify loop break/continue statement handling between java and kotlin 2022-06-23 08:45:11 +02:00
Ian Lynagh
8a89251c4f Kotlin: Tweak dbscheme 2022-05-10 19:51:31 +01:00
Ian Lynagh
bfe36558c1 Java/Kotlin: Update stats 2022-05-10 19:51:30 +01:00
Tamas Vajk
b66a3141f6 Extract functions using their name from JvmName annotation 2022-05-10 19:51:30 +01:00
Tamas Vajk
47799ae040 Code quality improvements + add dedicated DeadRefTypes test 2022-05-10 19:51:28 +01:00
Tamas Vajk
cdc7ed0e14 Extract container of adapter function as compiler generated 2022-05-10 19:51:28 +01:00
Tamas Vajk
22af7f0e89 Remove duplications of locatable and element in the DB scheme 2022-05-10 19:51:27 +01:00
Ian Lynagh
fac3699a5b Kotlin: Generate stats 2022-05-10 19:51:27 +01:00
Tamas Vajk
a6f036d94e Extract property references with only backing field 2022-05-10 19:51:23 +01:00
Tony Torralba
a6326b69dc Update java/ql/lib/config/semmlecode.dbscheme
Apply suggestion by @igfoo

Co-authored-by: Ian Lynagh <igfoo@github.com>
2022-05-10 19:51:22 +01:00
Tony Torralba
4b22e1a378 Extract WhenBranch as Stmt 2022-05-10 19:51:22 +01:00
Tamas Vajk
0ba2daf31a Adjust extraction to reuse KtProperty* relations 2022-05-10 19:51:22 +01:00
Tamas Vajk
f8343b8cc7 Extract local delegated properties 2022-05-10 19:51:22 +01:00
Chris Smowton
13cd145a76 Retain Member.getInitializer for Kotlin programs
I opt to identify any syntactic initializer. These are broader in scope than Java's member initializers, which are necessarily context-free, whereas in Kotlin the primary constructor's parameters can be referred to.
2022-05-10 19:51:20 +01:00
Tamas Vajk
18812c810c Add PropertyRefExpr QL class, change extraction to use it, and add tests 2022-05-10 19:51:19 +01:00
Chris Smowton
96f3ea460f Make varargs extraction more Java-like:
* Extract varargs as if they are ordinary positional arguments
* Adapt the QL that distinguishes varargs from ordinary arguments to account for Kotlin's varargs which can occur in the middle of the arg list
* Add a test checking dataflow through varargs which doesn't work yet due to array-get and array-set not being extracted as IndexExprs
* Extract the special case arrayOf(*x) as a clone call, which is (equivalent to) the Java lowering of that operation
2022-05-10 19:51:17 +01:00
Chris Smowton
a120fab9f7 Complete implementation of equality tests
- Create a new operator representing an infix value [in]equality test, equivalent to Objects.equals(lhs, rhs)
- Continue to use simple equality where it is clearly possible at the callsite
- Note that ieee754equals is the same as Java's == and != operators
2022-05-10 19:51:17 +01:00
Tamas Vajk
b4beddf2f9 Introduce cast for <unsafe-coerce> calls 2022-05-10 19:51:15 +01:00
Ian Lynagh
76ca0b2776 Kotlin: Pull Kotlin type for localvars out into its own table 2022-05-10 19:51:15 +01:00
Ian Lynagh
7862229807 Kotlin: Pull Kotlin type for params out into its own table 2022-05-10 19:51:15 +01:00
Ian Lynagh
dc26abe341 Kotlin: Pull Kotlin type for methods/constrs out into their own tables 2022-05-10 19:51:15 +01:00
Ian Lynagh
ee008773dc Kotlin: Pull Kotlin type for fields out into its own table 2022-05-10 19:51:15 +01:00
Ian Lynagh
86bf126ed8 Kotlin: Pull Kotlin type for expressions out into its own table 2022-05-10 19:51:15 +01:00
Tamas Vajk
cd5555a5dd Extract companion objects from interfaces 2022-05-10 19:51:15 +01:00
Ian Lynagh
89eae2407b Kotlin: Improve error handling
Each compilation, and each file within a cmopilation, now gets a
"result" indicating whether it had recoverable or non-recoverable
errors.
2022-05-10 19:51:15 +01:00
Ian Lynagh
6566f7b69f Kotlin: Add types for the different kinds of casts that Kotlin has
We might want to unify some of these in future, but doing that
correctly is easier than splitting them up correctly, so I've given each
one its own QL class for now.

I am not familiar with many of the libraries/queries that use CastExpr.
I've briefly looked at them and updated them in a way that looks
superficially reasonable, but some of the uses will probably want to be
refined later.
2022-05-10 19:51:13 +01:00
Tamas Vajk
ef2795c88b Add ktLocalFunction relation and tests for local and anonymous classes 2022-05-10 19:51:11 +01:00
Ian Lynagh
fb90c70e2e Kotlin: Extract visibility for properties 2022-05-10 19:51:11 +01:00
Tamas Vajk
fa5c3f9159 Remove and replace @anonymousclassdeclstmt with @localtypedeclstmt 2022-05-10 19:51:10 +01:00
Ian Lynagh
33757a1266 Kotlin: Extract whether a class is a "file" class 2022-05-10 19:51:09 +01:00