Commit Graph

10 Commits

Author SHA1 Message Date
Allan Shortlidge
ff9b541c57 AST/Sema: Sink isExported() queries from Sema to AST. 2025-03-15 23:47:29 -07:00
Rintaro Ishizaki
002d7d7cdf [Parse/AST] Remove PoundDiagnosticDecl
There is no reson to make a AST node for '#error' and '#warning'
directives. Parser knows the diagnostics should be emitted or not.
2025-03-07 21:48:01 -08:00
Doug Gregor
5b2520e379 Remove IfConfigDecl from the AST
The swift-syntax tree retains information about the parsed #if
regions. Drop it from the semantic AST.
2024-09-18 20:51:54 -07:00
Allan Shortlidge
185022cbb5 SILGen: Only skip decls nested in functions when the function is skipped.
If a function body is emitted, all of the declarations inside that function
body must be emitted, too. Previously, lazy var initializers were being skipped
regardless of whether the function containing them was skipped, resulting in
SIL verification errors (which were correctly predicting linker errors).

Resolves rdar://134708502.
2024-08-27 14:29:08 -07:00
Allan Shortlidge
d48f949f8c AST: Functions nested in exportable functions are also exportable.
Centralize the exportability checking logic for nested functions in the
`DeclExportabilityVisitor` utility. This logic was previously added to SILGen
but there should not be special casing for nested functions at that layer.
2024-06-28 16:08:37 -07:00
Allan Shortlidge
3c68c20ef5 AST: Handle TopLevelCodeDecl in DeclExportabilityVisitor. 2023-12-10 09:10:06 -08:00
Allan Shortlidge
a038f7d8c6 AST: Handle PoundDiagnosticDecl in DeclExportabilityVisitor. 2023-12-10 09:10:05 -08:00
Allan Shortlidge
9444534658 AST: Handle MacroExpansionDecl in DeclExportabilityVisitor.
Instances of `MacroExpansionDecl` may be found in the AST when declarations are
expanded from freestanding declaration macros and therefore exportability
computations must be prepared to handle them.

Resolves rdar://119449439
2023-12-10 09:10:05 -08:00
Allan Shortlidge
2d8b4d1b18 AST: Support ImportDecls in DeclExportabilityVisitor.
Resolves rdar://117438934
2023-10-24 22:58:51 -07:00
Allan Shortlidge
82923d580d AST: Expose DeclExportabilityVisitor.
Extract `ExternallyAccessibleDeclVisitor` from `Serialization.cpp` into its own
header and rename it to `DeclExportabilityVisitor` to better align with
terminology in other parts of the compiler. Ideally, `DeclExportabilityVisitor`
should become the canoncial implementation of for exportability checks,
consolidating logic that is currently spread between serialization, module
interface printing, TBDGen, and type checking. For now, it is only used in
serialization to implement serialization safety checks.
2023-09-15 17:15:48 -07:00