Skip to content

Conversation

@quinntaylor
Copy link
Contributor

Extract extractCompileTimeValue() function to recursively handle CompileTimeValue hierarchies.
Inline extractLiteralOutput() to only be used from the one remaining call site.
Refactor ExprKind::Call handling to reduce branching for args with a DefaultArgumentExpr.

Extract `extractCompileTimeValue()` function to recursively handle `CompileTimeValue` hierarchies.
Inline `extractLiteralOutput()` to only be used from the one remaining call site.
Refactor `ExprKind::Call` handling to reduce branching for args with a `DefaultArgumentExpr`.
@quinntaylor
Copy link
Contributor Author

@swift-ci test

if (originalInit) {
auto literalOutput = extractLiteralOutput(originalInit);
static std::shared_ptr<CompileTimeValue> extractCompileTimeValue(Expr *expr) {
if (expr) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were you seeing nullptrs passed into this function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is more of a precautionary construct, to avoid bad dereferences if nullptr were to get passed in, now or in the future.

@artemcm
Copy link
Contributor

artemcm commented Dec 8, 2022

@swift-ci test

@quinntaylor quinntaylor merged commit deae449 into swiftlang:main Dec 9, 2022
@quinntaylor quinntaylor deleted the const-extraction-recursion branch December 9, 2022 02:47
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.

3 participants