mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +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:
@@ -3930,6 +3930,26 @@ public:
|
||||
void noteCycleStep(DiagnosticEngine &diags) const;
|
||||
};
|
||||
|
||||
/// Expand a 'MacroExpansionExpr',
|
||||
class ExpandMacroExpansionExprRequest
|
||||
: public SimpleRequest<ExpandMacroExpansionExprRequest,
|
||||
Optional<unsigned>(MacroExpansionExpr *),
|
||||
RequestFlags::Cached> {
|
||||
public:
|
||||
using SimpleRequest::SimpleRequest;
|
||||
|
||||
private:
|
||||
friend SimpleRequest;
|
||||
|
||||
Optional<unsigned>
|
||||
evaluate(Evaluator &evaluator, MacroExpansionExpr *mee) const;
|
||||
|
||||
public:
|
||||
bool isCached() const { return true; }
|
||||
void diagnoseCycle(DiagnosticEngine &diags) const;
|
||||
void noteCycleStep(DiagnosticEngine &diags) const;
|
||||
};
|
||||
|
||||
/// Expand all accessor macros attached to the given declaration.
|
||||
///
|
||||
/// Produces the set of macro expansion buffer IDs.
|
||||
|
||||
@@ -439,6 +439,9 @@ SWIFT_REQUEST(TypeChecker, ExternalMacroDefinitionRequest,
|
||||
SWIFT_REQUEST(TypeChecker, ExpandMacroExpansionDeclRequest,
|
||||
ArrayRef<Decl *>(MacroExpansionDecl *),
|
||||
Cached, NoLocationInfo)
|
||||
SWIFT_REQUEST(TypeChecker, ExpandMacroExpansionExprRequest,
|
||||
ArrayRef<Decl *>(MacroExpansionExpr *),
|
||||
Cached, NoLocationInfo)
|
||||
SWIFT_REQUEST(TypeChecker, ExpandMemberAttributeMacros,
|
||||
ArrayRef<unsigned>(Decl *),
|
||||
Cached, NoLocationInfo)
|
||||
|
||||
Reference in New Issue
Block a user