Provide macro module name in MacroExpansionExpr creation

This properly passes the module name through from attached macros to
the freestanding macro that are used under-the-hood for type checking.
This commit is contained in:
Doug Gregor
2024-09-09 22:22:17 -07:00
parent 8fe0fd1781
commit 05e8140c6d
5 changed files with 20 additions and 10 deletions

View File

@@ -3032,7 +3032,9 @@ namespace {
auto macro = cast<MacroDecl>(overload.choice.getDecl());
ConcreteDeclRef macroRef = resolveConcreteDeclRef(macro, locator);
auto *expansion = MacroExpansionExpr::create(
dc, expr->getStartLoc(), DeclNameRef(macro->getName()),
dc, expr->getStartLoc(),
/*module name=*/DeclNameRef(), /*module name loc=*/DeclNameLoc(),
DeclNameRef(macro->getName()),
DeclNameLoc(expr->getLoc()), SourceLoc(), {}, SourceLoc(), nullptr,
MacroRole::Expression, /*isImplicit=*/true, expandedType);
expansion->setMacroRef(macroRef);