Commit Graph

4437 Commits

Author SHA1 Message Date
Geoffrey White
a5fff9af5d Swift: Create ArithmeticOperation.qll. 2022-06-28 15:34:15 +01:00
Geoffrey White
9e0cf62cda Swift: Fix + simplify LogicalOperation.qll. 2022-06-28 15:33:03 +01: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
5c6ac2a5f2 Swift: accept test results 2022-06-28 16:15:05 +02:00
Geoffrey White
63376da90f Swift: Add tests for LogicalOperaion.qll. 2022-06-28 15:04:47 +01:00
Paolo Tranquilli
6ff45d3dbe Merge main into redsun82/swift-enum-is-case 2022-06-28 16:03:38 +02:00
Paolo Tranquilli
364085a596 Swift: add DotSyntaxCallExpr tests 2022-06-28 15:44:42 +02:00
Paolo Tranquilli
7175869518 Swift: add missing newlines in trap
This is mostly cosmetic and for debugging, as the trap importer is
perfectly happy with trap entries on the same line without spaces
between them.
2022-06-28 15:17:18 +02:00
Paolo Tranquilli
131524d867 Swift: accept test changes
These are due to the changes on `toBeTested` that include canonical
types.
2022-06-28 12:16:08 +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
b41cbaec33 Swift: add possibility to add flags in tests 2022-06-28 12:01:36 +02:00
Paolo Tranquilli
f2b589743a Swift: add possibility to collapse class hierarchy in tests 2022-06-28 12:01:36 +02:00
Paolo Tranquilli
9d97fe7f30 Swift: generalize EnumIsCaseExpr test 2022-06-27 17:22:48 +02:00
Paolo Tranquilli
7f694f3b90 Swift: add EnumIsCase test 2022-06-27 16:25:46 +02:00
Mathias Vorreiter Pedersen
41b23572f0 Merge pull request #9673 from geoffw0/stringlengthconflation2
Swift: String length conflation query
2022-06-27 10:29:09 +01:00
Paolo Tranquilli
41fb55a7a8 Swift: extract all ReferenceStorageTypes 2022-06-24 18:10:31 +02:00
Geoffrey White
9013d56f37 Swift: Strengthen claim about severity in the qhelp. 2022-06-24 17:09:37 +01:00
Paolo Tranquilli
fd209e57cd Swift: extract InoutType 2022-06-24 17:29:46 +02:00
Geoffrey White
ef283d9b7a Swift: Metadata. 2022-06-24 16:20:16 +01: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
Geoffrey White
f2ae2dbe1f Swift: Consistency. 2022-06-24 12:28:10 +01:00
Geoffrey White
ef3d4f3242 Swift: Add qhelp and example. 2022-06-24 12:27:10 +01: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
8ca529e8d9 Swift: make Element::resolve final
One should only override `getResolveStep` (or `convertsFrom` for `Expr`
classes), as otherwise the resolution/conversion becomes inconsitent.
2022-06-24 10:05:58 +02:00
Paolo Tranquilli
bc44007e18 Swift: yet another fix to stub revert prevention 2022-06-24 09:40:03 +02:00
Paolo Tranquilli
a9bd784ba2 Swift: fix stub revert prevention
It turns out the threshold of 5 lines for stub modification detection
was too strict: in case of a long class name the QL formatter will put
the closing brace of the empty class definition on a new line, leading
to codegen fail with an error thinking the stub was modified.

On the other side of things, also adding a base to a stub class was not
being detected as a modification.

Now the modification test is slightly smarter. If the stub still marked
as generated and

* has more than 6 lines, or
* the contents does not match a regexp aproximation of a plain stub

then codegen will abort. The test will still avoid reading the whole
contents of all the stubs.
2022-06-24 09:02:40 +02:00
Geoffrey White
1a980c94a0 Swift: Query description. 2022-06-23 18:13:48 +01:00
Mathias Vorreiter Pedersen
71efffd79b Merge pull request #9691 from rdmarsh2/rdmarsh2/swift/ssa-perf-1
Swift: remove check for inout params in SSA gen
2022-06-23 17:16:38 +01:00
Geoffrey White
911d30bd9a Swift: Proper query message. 2022-06-23 17:12:02 +01:00
Robert Marsh
946d0358c9 Swift: remove check for inout params in SSA gen
This check is unnecessary since it's enforced by the compiler, and is
causing a bad join order.
2022-06-23 15:59:34 +00:00
Paolo Tranquilli
ad38cf2026 Swift: prevent accidental revert of modified stub
If one modifies a QL stub but forgets to remove the `// generated`
header comment, codegen will now abort with an error rather than
silently reverting the change.

This is based on the rough heuristic of just counting the lines. If any
change is done to the stub class, the number of lines is bound to be
5 or more.
2022-06-23 17:49:21 +02:00
Paolo Tranquilli
7334b4e03a Swift: autopep8 all python files
Additionally set up a pre-commit hook and a CI check for that.
2022-06-23 17:13:56 +02:00
Geoffrey White
64d7296847 Swift: Remove redundant cast. 2022-06-23 16:04:26 +01:00
Geoffrey White
3291029e6d Swift: Address further review comments. 2022-06-23 16:00:56 +01:00
Geoffrey White
ebcb1e9448 Swift: Clean up other uses of toString. 2022-06-23 15:53:55 +01:00
Paolo Tranquilli
8d4637ddfd Swift: tag -> pragma in codegen
For the use the former tags are meant for, pragma is a more
meaningful name. It now also accepts both strings and lists of strings.
2022-06-23 14:52:21 +02:00
Anders Schack-Mulligen
dc517a758e Autoformat 2022-06-23 14:44:40 +02:00
Anders Schack-Mulligen
4a317a25d3 Dataflow: Sync. 2022-06-23 14:34:52 +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
Geoffrey White
3b48cb02bc Swift: Add Type.getName(). 2022-06-23 12:54:56 +01:00
Geoffrey White
01f697abe9 Swift: Rename argName -> paramName. 2022-06-23 12:16:04 +01:00
Geoffrey White
5222ba9073 Swift: Suggestions from review. 2022-06-23 12:02:32 +01:00
Mathias Vorreiter Pedersen
9b587843ff Merge pull request #9669 from rdmarsh2/rdmarsh2/swift/dataflow-lambda-flow
Swift: implement LambdaCall in dataflow library
2022-06-23 10:38:45 +01:00
AlexDenisov
decb136471 Update swift/extractor/SwiftExtractor.cpp
Co-authored-by: Paolo Tranquilli <redsun82@github.com>
2022-06-23 07:23:17 +02:00