|
52 | 52 | #include "swift/Subsystems.h" |
53 | 53 | #include "llvm/Config/config.h" |
54 | 54 |
|
| 55 | +#define DEBUG_TYPE "macros" |
| 56 | + |
55 | 57 | using namespace swift; |
56 | 58 |
|
57 | 59 | /// Translate an argument provided as a string literal into an identifier, |
@@ -1201,6 +1203,11 @@ evaluateFreestandingMacro(FreestandingMacroExpansion *expansion, |
1201 | 1203 |
|
1202 | 1204 | PrettyStackTraceFreestandingMacroExpansion debugStack( |
1203 | 1205 | "expanding freestanding macro", expansion); |
| 1206 | + LLVM_DEBUG( |
| 1207 | + llvm::dbgs() << "\nexpanding macro:\n"; |
| 1208 | + macro->print(llvm::dbgs(), PrintOptions::printEverything()); |
| 1209 | + llvm::dbgs() << "\n"; |
| 1210 | + ); |
1204 | 1211 |
|
1205 | 1212 | // Builtin macros are handled via ASTGen. |
1206 | 1213 | auto *astGenSourceFile = sourceFile->getExportedSourceFile(); |
@@ -1527,6 +1534,18 @@ static SourceFile *evaluateAttachedMacro(MacroDecl *macro, Decl *attachedTo, |
1527 | 1534 | auto *astGenAttrSourceFile = attrSourceFile->getExportedSourceFile(); |
1528 | 1535 | if (!astGenAttrSourceFile) |
1529 | 1536 | return nullptr; |
| 1537 | + LLVM_DEBUG( |
| 1538 | + StreamPrinter P(llvm::dbgs()); |
| 1539 | + llvm::dbgs() << "\nexpanding macro:\n"; |
| 1540 | + attr->print(P, PrintOptions::printEverything(), attachedTo); |
| 1541 | + llvm::dbgs() << "\nattached to:\n"; |
| 1542 | + attachedTo->print(P, PrintOptions::printEverything()); |
| 1543 | + if (parentDecl) { |
| 1544 | + llvm::dbgs() << "\nwith parent:\n"; |
| 1545 | + parentDecl->print(P, PrintOptions::printEverything()); |
| 1546 | + } |
| 1547 | + llvm::dbgs() << "\n"; |
| 1548 | + ); |
1530 | 1549 |
|
1531 | 1550 | auto *astGenDeclSourceFile = declSourceFile->getExportedSourceFile(); |
1532 | 1551 | if (!astGenDeclSourceFile) |
@@ -1677,6 +1696,14 @@ static SourceFile *evaluateAttachedMacro(MacroDecl *macro, |
1677 | 1696 | #if SWIFT_BUILD_SWIFT_SYNTAX |
1678 | 1697 | PrettyStackTraceExpr debugStack( |
1679 | 1698 | ctx, "expanding attached macro", attachedTo); |
| 1699 | + LLVM_DEBUG( |
| 1700 | + StreamPrinter P(llvm::dbgs()); |
| 1701 | + llvm::dbgs() << "\nexpanding macro:\n"; |
| 1702 | + attr->print(P, PrintOptions::printEverything(), nullptr); |
| 1703 | + llvm::dbgs() << "\nattached to:\n"; |
| 1704 | + attachedTo->print(P, PrintOptions::printEverything()); |
| 1705 | + llvm::dbgs() << "\n"; |
| 1706 | + ); |
1680 | 1707 |
|
1681 | 1708 | auto *astGenAttrSourceFile = attrSourceFile->getExportedSourceFile(); |
1682 | 1709 | if (!astGenAttrSourceFile) |
|
0 commit comments