Commit Graph

18 Commits

Author SHA1 Message Date
Paolo Tranquilli
0e62d6f123 Swift: update extractor to new IfConfigDecl 2022-09-20 15:12:37 +02:00
Paolo Tranquilli
43e5abac39 Swift: do not extract unresolved things from IfConfigDecl
This avoids extracting things that are unresolved within an
`IfConfigDecl` instance:
* all conditions
* all inactive code blocks
This is meant to test out the hypothesis that this should solve some
extractor issues. If going through with it we should definitely change
the schema model for this.

Also, tests have not been updated and are expected to fail.
2022-09-12 16:34:28 +02:00
Paolo Tranquilli
ebc7432f46 Swift: implement imported_ and exported_modules
This has expanded the required builtin symbols.
2022-08-26 11:37:14 +02:00
Paolo Tranquilli
606b9e6e38 Revert "Swift: rollback removal of std::variant"
This reverts commit 50d9a2e9cd.
2022-08-25 09:12:35 +02:00
Paolo Tranquilli
610c788e34 Merge pull request #10156 from github/redsun82/swift-import-optional-module
Swift: make `ImportDecl:imported_module` optional
2022-08-24 15:18:04 +02:00
Paolo Tranquilli
2ee8d1a9d3 Swift: implement optional ImportDecl:imported_module 2022-08-24 14:31:55 +02:00
Mathias Vorreiter Pedersen
1d50dd54ce Merge branch 'main' into swift-extract-this-param-decl 2022-08-24 10:14:18 +01:00
Mathias Vorreiter Pedersen
273053c92a Swift: Extract self parameter declarations. 2022-08-24 10:01:25 +01:00
Paolo Tranquilli
50d9a2e9cd Swift: rollback removal of std::variant
It turns out we are still missing some extractions. This will be fixed
with future work.
2022-08-24 09:44:37 +02:00
Paolo Tranquilli
2fc88d5f8e Swift: add module to Decl and remove forward traps
Add module context to all declarations. As keeping the `std::variant`s
required slightly more work for this, and we intended to remove them
any way, this is done in this change.

For background, we put those in as we were not extracting all modules at
the time, so we were missing some DB ids that we put back in by adding
the "defining" traps not only in the trap file related to the defining
module but also to the one where the declaration was used. Since then
we fixed module extraction, so this should not be needed any more.
2022-08-23 16:53:07 +02:00
Paolo Tranquilli
4ce100f9a3 Swift: append clang module names in trap keys
We have found out there can be separate declarations (`VarDecl` or
`AccessorDecl`) which are effectively the same (with equal mangled name)
but come from different clang modules. This is the case for example
for glibc constants like `L_SET` that appear in both `SwiftGlibc` and
`CDispatch`.

In this patch, we simply avoid full deduplication in that case by
appending the module name to the trap key for non-swift modules.

A more solid solution should be found in the future.
2022-07-29 16:56:51 +02:00
AlexDenisov
48e93b3654 Merge pull request #9925 from github/alexdenisov/pcm-var-dedup
Swift: do not deduplicate PCM variables (as the mangler crashes there sometimes)
2022-07-29 14:30:41 +02:00
Alex Denisov
34edb2537f Swift: mangle TypeAliasDecls differently 2022-07-29 14:12:02 +02:00
Alex Denisov
5b1fe56d5f Swift: do not deduplicate PCM variables (as the mangler crashes there sometimes) 2022-07-29 14:06:18 +02:00
Paolo Tranquilli
76ea63ffbe Swift: deduplicate VarDecl
Deduplication of `ConcreteVarDecl` is triggered only if its
`DeclContext` is not local. This avoids a mangled name conflict.

Also added more thourough tests for `ConcreteVarDecl` and `ParamDecl`.
2022-07-28 12:28:52 +02:00
Paolo Tranquilli
39406436bf Swift: extract IfConfigDecl
This also adds `UnresolvedDeclRefExpr` tests, as `IfConfigDecl`
consistently introduces those.
2022-07-11 15:11:13 +02:00
Paolo Tranquilli
3a975174c3 Swift: extract ImportDecl and ModuleDecl
As `ASTMangler` crashes when called on `ModuleDecl`, we simply use
its name.

This might probably not work reliably in a scenario where multiple
modules are compiled with the same name (like `main`), but this is left
for future work. At the moment this cannot create DB inconsistencies.
2022-07-01 15:29:30 +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