Skip to content

Conversation

@hnrklssn
Copy link
Member

@hnrklssn hnrklssn commented Jun 11, 2025

Calling `DeclMustBeEmitted` should not lead to more deserialization, as
it may occur before previous deserialization has finished.
When passed a `VarDecl` with an initializer however, `DeclMustBeEmitted`
needs to know whether that initializer contains side effects. When the
`VarDecl` is deserialized but the initializer is not, this triggers
deserialization of the initializer. To avoid this we add a bit to the
serialization format for `VarDecl`s, indicating whether its initializer
contains side effects or not, so that the `ASTReader` can query this
information directly without deserializing the initializer.

rdar://153085264

This is a cherry-pick of 319a51a5ffb807b88ae7f73676894bf306a0d134

@hnrklssn hnrklssn requested a review from a team as a code owner June 11, 2025 15:57
@hnrklssn
Copy link
Member Author

@swift-ci please test

…lvm#143739)

Calling `DeclMustBeEmitted` should not lead to more deserialization, as
it may occur before previous deserialization has finished.
When passed a `VarDecl` with an initializer however, `DeclMustBeEmitted`
needs to know whether that initializer contains side effects. When the
`VarDecl` is deserialized but the initializer is not, this triggers
deserialization of the initializer. To avoid this we add a bit to the
serialization format for `VarDecl`s, indicating whether its initializer
contains side effects or not, so that the `ASTReader` can query this
information directly without deserializing the initializer.

rdar://153085264

This is a cherry-pick of 319a51a
@hnrklssn hnrklssn force-pushed the remove-deserialize-assert branch from 5bace4c to c8d3e93 Compare June 23, 2025 17:26
@hnrklssn hnrklssn changed the title Cherry-pick [ASTReader] Remove assert in GetExternalDeclStmt Cherry-pick [Modules] Record whether VarDecl initializers contain side effects (#143739) Jun 23, 2025
@hnrklssn
Copy link
Member Author

@swift-ci please test

@hnrklssn
Copy link
Member Author

@swift-ci please test llvm

Normally expressions passed to EvaluateInPlace have a type, but not when
a VarDecl initializer is evaluated before the untyped ParenListExpr is
replaced with a CXXConstructExpr. This can happen in LLDB. In these
cases consteval fails.
@hnrklssn
Copy link
Member Author

@swift-ci please test

@hnrklssn
Copy link
Member Author

@swift-ci please test macos

1 similar comment
@hnrklssn
Copy link
Member Author

@swift-ci please test macos

@hnrklssn
Copy link
Member Author

Closed in favour of #10925 targeting swift/release/6.2 rather than stable/20240723

@hnrklssn hnrklssn closed this Jun 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant