Commit Graph

65 Commits

Author SHA1 Message Date
Doug Gregor
0e2cce59a8 Make sure we visit auxiliary declarations for symbol visitation.
SIL symbol visitation wasn't visiting top-level auxiliary declarations,
which meant that it skipped peer and freestanding macros at module
scope. This would manifest in errors of the form

    <symbol> is in the generated IR file, but not in TBD file

Fixes rdar://107426276.
2023-04-05 11:45:41 -07:00
Doug Gregor
87d706a2c9 Revert "Also visit auxiliary declarations of top-level decls"
This reverts commit 17f568613c.
2023-03-06 21:16:55 -08:00
Doug Gregor
17f568613c Also visit auxiliary declarations of top-level decls 2023-03-06 00:10:54 -08:00
Doug Gregor
88b76b2f88 Make sure we visit auxiliary declarations for all SIL symbol visitation
Addresses IRGen, TBD generation, and so on
2023-03-05 23:55:36 -08:00
Holly Borla
3f462f0f43 [Decl] Add MissingDecl to use for parser recovery. 2023-01-15 09:55:15 -08:00
Pavel Yaskevich
b83b0943b5 [SILDeclRef] RuntimeMetadata: Add a special kind for runtime attribute generator
A new `RuntimeAttributeGenerator` is used to reference runtime
attribute generator functions synthesized by SILGen.
`#function` magic literal points to the declaration that declaration
attribute is attached to.
2022-12-20 09:45:01 -08:00
Pavel Yaskevich
3fb69b3c3c [SIL] SILFunction: Add runtime accessible function attribute
This attribute indicates that the given SILFunction has to be
added to "accessible functions" section and could be looked up
at runtime using a special API.
2022-12-20 09:33:44 -08:00
Cyndy Ishida
af742ad02b [TBDGen] Ensure classes that emit ObjC MetaClass also emit (#62283)
matching ObjC Class symbols

This is to account for swift class definitions that have objc class
ancestory.

resolves: rdar://102525824
2022-11-29 07:14:42 -08:00
Erik Eckstein
ab1b343dad use new llvm::Optional API
`getValue` -> `value`
`getValueOr` -> `value_or`
`hasValue` -> `has_value`
`map` -> `transform`

The old API will be deprecated in the rebranch.
To avoid merge conflicts, use the new API already in the main branch.

rdar://102362022
2022-11-21 19:44:24 +01:00
Doug Gregor
51fcde7b76 Merge pull request #62086 from DougGregor/macro-decl 2022-11-13 20:25:48 -08:00
Doug Gregor
5ab6b72604 [Macros] Turn Macro into a declaration node.
Although the declaration of macros doesn't appear in Swift source code
that uses macros, they still operate as declarations within the
language. Rework `Macro` as `MacroDecl`, a generic value declaration,
which appropriate models its place in the language.

The vast majority of this change is in extending all of the various
switches on declaration kinds to account for macros.
2022-11-13 12:21:29 -08:00
Cyndy Ishida
98fa58408f [swift][TBDGen] Stop adding redundant ObjC Classes (#62068)
TBD files contain a section reserved for obj-c classes. Previously,
TBDGen was adding symbols with this + normal globals with objc class
prefixes. This patch removes the extra globals being added.

This also accounts for this behavior for `validate-tbd-against-ir`
checking.

Resolves: rdar://101442087
2022-11-11 20:36:31 -08:00
Allan Shortlidge
49e0015b8f SIL: Emit symbols methods associated with methods from SILSymbolVisitor when visiting a FuncDecl.
Previously, dispatch thunks and method descriptors were only emitted when visiting the containing `ClassDecl`. IRGen for `#_hasSymbol` requires visiting the `FuncDecl` directly.
2022-11-04 11:16:25 -07:00
Allan Shortlidge
38779f32c1 SILGen/IRGen: Delegate decision to skip @_silgen_name functions to TBDGenVisitor.
This allows SILGen for `#_hasSymbol` conditions to visit them and emit a declaration of the function appropriately.
2022-11-02 21:38:33 -07:00
Allan Shortlidge
a44b54b818 NFC: Refactor the logic of TBDGenVisitor into two helper classes; SILSymbolVisitor and IRSymbolVisitor. 2022-10-30 09:14:29 -07:00