[SourceKit] Add macro expansion support for conformance macros

This commit is contained in:
Doug Gregor
2023-03-01 22:07:25 -08:00
parent d1bfe72a45
commit eb06129463
2 changed files with 25 additions and 1 deletions

View File

@@ -8549,6 +8549,14 @@ getMacroExpansionBuffers(MacroDecl *macro, const CustomAttr *attr, Decl *decl) {
allBufferIDs.append(bufferIDs.begin(), bufferIDs.end());
}
if (roles.contains(MacroRole::Conformance)) {
if (auto nominal = dyn_cast<NominalTypeDecl>(decl)) {
auto bufferIDs = evaluateOrDefault(
ctx.evaluator, ExpandConformanceMacros{nominal}, { });
allBufferIDs.append(bufferIDs.begin(), bufferIDs.end());
}
}
// Drop any buffers that come from other macros. We could eliminate this
// step by adding more fine-grained requests above, which only expand for a
// single custom attribute.