mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Macros] Requestify MacroExpansionExpr expansion
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
This commit is contained in:
@@ -8622,11 +8622,9 @@ bool RefactoringActionAddAsyncWrapper::performChange() {
|
||||
/// expression.
|
||||
static Optional<unsigned> getMacroExpansionBuffer(
|
||||
SourceManager &sourceMgr, MacroExpansionExpr *expansion) {
|
||||
if (auto rewritten = expansion->getRewritten()) {
|
||||
return sourceMgr.findBufferContainingLoc(rewritten->getStartLoc());
|
||||
}
|
||||
|
||||
return None;
|
||||
return evaluateOrDefault(
|
||||
expansion->getDeclContext()->getASTContext().evaluator,
|
||||
ExpandMacroExpansionExprRequest{expansion}, {});
|
||||
}
|
||||
|
||||
/// Retrieve the macro expansion buffer for the given macro expansion
|
||||
|
||||
Reference in New Issue
Block a user