Commit Graph

9 Commits

Author SHA1 Message Date
Allan Shortlidge
e8ae38365d SILOptimizer: Compute ProtocolConformanceAnalysis cache lazily.
When serializing modules with `-experimental-skip-all-function-bodies`, this
analysis was eagerly populating a cache that would go unused since there is no
optimization to do. With `-experimental-lazy-typecheck`, this work would also
trigger unnecessary typechecking requests. NFC.
2023-08-31 10:58:56 -07:00
Doug Gregor
200f2340d9 [Macros] Be deliberate about walking macro arguments vs. expansions
Provide ASTWalker with a customization point to specify whether to
check macro arguments (which are type checked but never emitted), the
macro expansion (which is the result of applying the macro and is
actually emitted into the source), or both. Provide answers for the
~115 different ASTWalker visitors throughout the code base.

Fixes rdar://104042945, which concerns checking of effects in
macro arguments---which we shouldn't do.
2023-02-28 17:48:23 -08:00
Hamish Knight
4716f61fba [AST] Introduce explicit actions for ASTWalker
Replace the use of bool and pointer returns for
`walkToXXXPre`/`walkToXXXPost`, and instead use
explicit actions such as `Action::Continue(E)`,
`Action::SkipChildren(E)`, and `Action::Stop()`.
There are also conditional variants, e.g
`Action::SkipChildrenIf`, `Action::VisitChildrenIf`,
and `Action::StopIf`.

There is still more work that can be done here, in
particular:

- SourceEntityWalker still needs to be migrated.
- Some uses of `return false` in pre-visitation
methods can likely now be replaced by
`Action::Stop`.
- We still use bool and pointer returns internally
within the ASTWalker traversal, which could likely
be improved.

But I'm leaving those as future work for now as
this patch is already large enough.
2022-09-13 10:35:29 +01:00
Slava Pestov
701f782a2b SILOptimizer: Stop calling getAllConformances() on protocols 2022-08-23 00:03:37 -04:00
Ben Barham
b07c06e839 [Serialization] Fix crashes when allowing compiler errors in modules 2020-11-18 12:35:21 +10:00
Raj Barik
0070730e5a Perform ExistentialSpecializer when SoleConformingType is known 2019-01-07 14:47:39 -08:00
Raj Barik
07662a1321 Fix for extensions in ProtocolConformanceAnalysis 2018-12-17 10:39:40 -08:00
Raj Barik
d9a051ecdc Concrete type propagation using ProtocolConformanceAnalysis 2018-08-22 11:08:29 -07:00
Raj Barik
c2aef11cff ProtocolConformanceAnalysis for a non-public protocol returns all the types (classes, structs, and enums) that conform to it. It is performed in the whole-module-compilation mode. 2018-06-18 13:38:24 -07:00