-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Macros] Requestify MacroExpansionExpr expansion #65453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Macros] Requestify MacroExpansionExpr expansion #65453
Conversation
@swift-ci Please smoke test |
73a82e6
to
c9fb369
Compare
@swift-ci Please smoke test |
lib/Sema/TypeCheckMacros.cpp
Outdated
ExpandMacroExpansionExprRequest::evaluate(Evaluator &evaluator, | ||
MacroExpansionExpr *mee) const { | ||
assert(mee->getMacroRef() && "MacroRef should be set before expansion"); | ||
return expandMacroExpr(mee); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove expandMacroExpr
and move its implementation into here? All callers should be using the request right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, but in this PR, I'd like to follow the scheme of ExpandMacroExpansionDeclRequest
/expandFreestandingMacro()
.
@@ -265,3 +269,6 @@ macro anonymousTypes(_: () -> String) = #externalMacro(module: "MacroDefinition" | |||
// RUN: %sourcekitd-test -req=format -line=23 -length=1 %s | %FileCheck -check-prefix=FORMATTED %s | |||
// FORMATTED: " var x: Int" | |||
|
|||
//##-- Expansion on "fails to typecheck" macro expression | |||
// RUN: %sourcekitd-test -req=refactoring.expand.macro -pos=61:2 %s -- ${COMPILER_ARGS[@]} | %FileCheck -check-prefix=ERRNEOUS_EXPAND %s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: ERRONEOUS
c9fb369
to
f6bdd26
Compare
@swift-ci Please smoke test |
f6bdd26
to
ec07e83
Compare
The request returns the expanded buffer ID even if it failed to typecheck the expanded buffer. This makes refactoring 'Expand Macro' work regardless of the typechecking results. rdar://108530760
ec07e83
to
35db928
Compare
@swift-ci Please smoke test |
The request returns the expanded buffer ID even if it failed to typecheck the expanded buffer.
This makes refactoring 'Expand Macro' work regardless of the typechecking results.
rdar://108530760