@@ -4457,10 +4457,21 @@ void ASTMangler::appendMacroExpansionContext(
44574457 ASTContext &ctx = origDC->getASTContext ();
44584458 SourceManager &sourceMgr = ctx.SourceMgr ;
44594459
4460+ auto appendMacroExpansionLoc = [&]() {
4461+ appendIdentifier (origDC->getParentModule ()->getName ().str ());
4462+
4463+ auto *SF = origDC->getParentSourceFile ();
4464+ appendIdentifier (llvm::sys::path::filename (SF->getFilename ()));
4465+
4466+ auto lineColumn = sourceMgr.getLineAndColumnInBuffer (loc);
4467+ appendOperator (" fMX" , Index (lineColumn.first ), Index (lineColumn.second ));
4468+ };
4469+
44604470 auto bufferID = sourceMgr.findBufferContainingLoc (loc);
44614471 auto generatedSourceInfo = sourceMgr.getGeneratedSourceInfo (bufferID);
4462- if (!generatedSourceInfo)
4463- return appendContext (origDC, nullBase, StringRef ());
4472+ if (!generatedSourceInfo) {
4473+ return appendMacroExpansionLoc ();
4474+ }
44644475
44654476 SourceLoc outerExpansionLoc;
44664477 DeclContext *outerExpansionDC;
@@ -4479,7 +4490,7 @@ void ASTMangler::appendMacroExpansionContext(
44794490 case GeneratedSourceInfo::PrettyPrinted:
44804491 case GeneratedSourceInfo::ReplacedFunctionBody:
44814492 case GeneratedSourceInfo::DefaultArgument:
4482- return appendContext (origDC, nullBase, StringRef () );
4493+ return appendMacroExpansionLoc ( );
44834494 }
44844495
44854496 switch (generatedSourceInfo->kind ) {
@@ -4536,7 +4547,7 @@ void ASTMangler::appendMacroExpansionContext(
45364547 // If we hit the point where the structure is represented as a DeclContext,
45374548 // we're done.
45384549 if (origDC->isChildContextOf (outerExpansionDC))
4539- return appendContext (origDC, nullBase, StringRef () );
4550+ return appendMacroExpansionLoc ( );
45404551
45414552 // Append our own context and discriminator.
45424553 appendMacroExpansionContext (outerExpansionLoc, origDC);
0 commit comments