Commit Graph

535 Commits

Author SHA1 Message Date
AlexDenisov
b9f4a09f19 Merge branch 'main' into alexdenisov/swift-multiple-modules 2022-06-30 10:13:34 +02:00
Alex Denisov
1dd3141e2d Swift: address more code review comments 2022-06-30 08:57:22 +02:00
Alex Denisov
35da75f685 Swift: rename method 2022-06-30 08:48:36 +02:00
AlexDenisov
522d48aa33 Apply suggestions from code review
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2022-06-30 08:47:17 +02:00
Alex Denisov
5233a5e17b Swift: also extract imported modules 2022-06-29 17:27:57 +02:00
Alex Denisov
4d81206a87 Swift: teach extractor to emit build artifacts for later consumption 2022-06-29 10:58:24 +02:00
AlexDenisov
e1ef637c54 Update swift/extractor/SwiftExtractorConfiguration.h
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2022-06-29 10:16:14 +02:00
Alex Denisov
488befb577 Swift: store TRAP files in a temporary folder until the extraction is complete
Currently, we have a number of assertions in the codebase and certain
assumptions about the AST. These don't always hold, sometimes leading to
a crash in the extractor.
The crashes leave incomplete TRAP files that cannot be imported into the
database.

With this change, we still get those incomplete TRAP files, but we also
get a database in the end (even thoough it is also incomplete as we
cannot import everything).
2022-06-29 07:17:06 +02:00
Paolo Tranquilli
363f7a88a9 Swift: fix QL warnings about overriding methods
The `getName` in `Type.qll` was issuing a warning in other generated
classes having a `getName` from a `name` property in `schema.yml`.

To fix the possible inconsistency, `diagnostic_name` is being renamed to
`name` in the schema. Despite the scary doc comment on
`swift::Type::getString` (namely `for use in diagnostics only`), that
seems to be the right generic naming mechanism for types, and it
coincides with the name we were extracting on types with an explicit
`name` property.

In case we find a case where `Type::getString` gives something wrong,
we can probably just patch it on that specific type class.
2022-06-28 16:30:25 +02:00
Paolo Tranquilli
68a341d72c Swift: use createEntry in the whole type visitor 2022-06-28 12:06:19 +02:00
Paolo Tranquilli
57981384df Swift: extract ProtocolComposition- and BuiltinType 2022-06-28 12:01:36 +02:00
Paolo Tranquilli
41fb55a7a8 Swift: extract all ReferenceStorageTypes 2022-06-24 18:10:31 +02:00
Paolo Tranquilli
fd209e57cd Swift: extract InoutType 2022-06-24 17:29:46 +02:00
Paolo Tranquilli
189a47e30d Swift: extract VariadicSequenceType 2022-06-24 17:15:45 +02:00
Paolo Tranquilli
346110e8dd Swift: extract DynamicSelfType 2022-06-24 16:49:58 +02:00
Paolo Tranquilli
4281605ba7 Swift: extract existential types 2022-06-24 16:28:18 +02:00
Paolo Tranquilli
631156dbc6 Swift: extract Nested- and PrimaryArchetypeType 2022-06-24 16:28:17 +02:00
Paolo Tranquilli
299e1af22e Merge main into redsun82/swift-code-reorg 2022-06-24 13:06:14 +02:00
Paolo Tranquilli
80ffd81b2c Merge pull request #9614 from github/alexdenisov/swift-extract-all-inputs-with-outputs
Swift: extract all output-producing source files, not only primary files
2022-06-24 12:23:36 +02:00
Paolo Tranquilli
a9877ed2fd Swift: split generated C++ files by directory 2022-06-23 14:24:03 +02:00
Paolo Tranquilli
b2ebf63d2e Swift: split generated C++ code into .h and .cpp 2022-06-23 14:22:58 +02:00
AlexDenisov
decb136471 Update swift/extractor/SwiftExtractor.cpp
Co-authored-by: Paolo Tranquilli <redsun82@github.com>
2022-06-23 07:23:17 +02:00
Paolo Tranquilli
cfde68023d Swift: fix includes jumbled by IDE 2022-06-22 18:17:40 +02:00
Paolo Tranquilli
22321aa124 Swift: reorganize code
Visitor code has been split between header and sources to speed up
incremental build. Moreover the code was reorganized using a new `infra`
bazel package (and `visitors` got promoted to a bazel package as well).
2022-06-22 18:11:58 +02:00
Paolo Tranquilli
1fc2bc4938 Swift: really fix tests 2022-06-22 16:15:02 +02:00
Paolo Tranquilli
3ed783df7f Swift: fix tests 2022-06-22 12:14:47 +02:00
Paolo Tranquilli
ee5c30ebda Merge main into redsun82/swift-extraction 2022-06-22 11:11:20 +02:00
Paolo Tranquilli
1e4ac44362 Swift: some expression extractions 2022-06-21 17:31:40 +02:00
Paolo Tranquilli
c77fc26c69 Swift: Callable abstraction
This new class encompasses both `AbstractFunctionDecl` and
`AbstractClosureExpr`, together with their common parts (namely
parameters and the body).

`ClosureExpr` and `AutoClosureExpr` got ported to structured C++
generated translation in the process.
2022-06-21 15:50:35 +02:00
Paolo Tranquilli
3d222a7377 Merge main into redsun82/swift-use-generated-classes 2022-06-20 18:02:13 +02:00
Paolo Tranquilli
48584a6c2e Merge main into redsun82/swift-use-generated-classes 2022-06-20 17:53:21 +02:00
Mathias Vorreiter Pedersen
850a90d9a8 Swift: Change the declaration names generated by the extractor to match the output of the Swift compiler. 2022-06-20 14:57:16 +01:00
Alex Denisov
42dc6814f0 Swift: extract all output-producing source files, not only primary files 2022-06-20 14:06:54 +02:00
Paolo Tranquilli
90f0e3ee72 Swift: remove forgotten resolved TODO 2022-06-20 13:08:28 +02:00
Paolo Tranquilli
95a6c5d4e5 Swift: fix emission of synthesized entities
This was temporarily broken as we were skipping full emission of all
entities without any valid location.

We now rely on `decl->getDeclContext()->getParentSourceFile()` which is
more robust.
2022-06-20 13:00:05 +02:00
Paolo Tranquilli
a91c94c38b Swift: temporarily disable failing test 2022-06-20 10:32:19 +02:00
Paolo Tranquilli
1f53b7fbe8 Merge main into alexdenisov/xref-decls 2022-06-20 10:25:29 +02:00
Paolo Tranquilli
be210aa3af Merge alexdenisov/xref-decls into redsun82/swift-use-generated-classes 2022-06-17 17:03:30 +02:00
Alex Denisov
08ad95b769 Swift: switch to references instead of pointers 2022-06-15 14:19:31 +02:00
AlexDenisov
343ba5ffa8 Update swift/extractor/SwiftDispatcher.h
Co-authored-by: Paolo Tranquilli <redsun82@github.com>
2022-06-15 14:13:50 +02:00
Alex Denisov
1c9a684ac6 Swift: Introduce SwiftExtractionMode 2022-06-15 09:25:01 +02:00
Mathias Vorreiter Pedersen
b0c66dda3a Merge pull request #9556 from MathiasVP/swift-extract-closure-params
Swift: Extract closure parameters
2022-06-15 08:07:08 +01:00
Mathias Vorreiter Pedersen
4595a9cf0b Swift: Extract parameters to closure expressions. 2022-06-14 20:38:57 +01:00
Alex Denisov
26d3c4a7fc Swift: extract system and builtin modules separately 2022-06-14 14:15:48 +02:00
Alex Denisov
9681358a6d Swift: extract OtherConstructorDeclRefExpr 2022-06-14 12:53:25 +02:00
Alex Denisov
e677b78ab9 Swift: attach NominalTypeDecl to the ExtensionDecl 2022-06-14 12:09:26 +02:00
Alex Denisov
cf0fc5829f Swift: extract extension declarations 2022-06-14 08:22:43 +02:00
Mathias Vorreiter Pedersen
6c8982b46e Merge pull request #9469 from rdmarsh2/rdmarsh2/swift/dataflow-inout
Swift: Dataflow through inout parameters
2022-06-13 18:11:11 +01:00
Mathias Vorreiter Pedersen
32ef535ad7 Merge pull request #9430 from github/redsun82/swift-unknown-location
Swift: add `UnknownLocation`
2022-06-13 10:55:53 +02:00
Paolo Tranquilli
28d2fd7a22 Merge pull request #9416 from github/redsun82/swift-codegen-docs
Swift: document and partially simplify codegen
2022-06-13 10:50:16 +02:00