Skip to content

Commit fcf4703

Browse files
committed
Strip PCMacro of its TopLevelContext
1 parent faa66f1 commit fcf4703

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

include/swift/Subsystems.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ namespace swift {
168168
/// Once parsing and name-binding are complete this optionally walks the ASTs
169169
/// to add calls to externally provided functions that simulate
170170
/// "program counter"-like debugging events.
171-
void performPCMacro(SourceFile &SF, TopLevelContext &TLC);
171+
void performPCMacro(SourceFile &SF);
172172

173173
/// Creates a type checker instance on the given AST context, if it
174174
/// doesn't already have one.

lib/Frontend/Frontend.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ void CompilerInstance::parseAndCheckTypesUpTo(
861861
performTypeChecking(SF, PersistentState->getTopLevelContext());
862862

863863
if (!Context->hadError() && Invocation.getFrontendOptions().PCMacro) {
864-
performPCMacro(SF, PersistentState->getTopLevelContext());
864+
performPCMacro(SF);
865865
}
866866

867867
// Playground transform knows to look out for PCMacro's changes and not

lib/Immediate/REPL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ typeCheckREPLInput(ModuleDecl *MostRecentModule, StringRef Name,
193193
parseIntoSourceFile(REPLInputFile, BufferID, &Done, nullptr,
194194
&PersistentState);
195195
} while (!Done);
196-
performTypeChecking(REPLInputFile, PersistentState.getTopLevelContext());
196+
performTypeChecking(REPLInputFile);
197197
return REPLModule;
198198
}
199199

lib/Sema/PCMacro.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -665,14 +665,13 @@ class Instrumenter : InstrumenterBase {
665665

666666
} // end anonymous namespace
667667

668-
void swift::performPCMacro(SourceFile &SF, TopLevelContext &TLC) {
668+
void swift::performPCMacro(SourceFile &SF) {
669669
class ExpressionFinder : public ASTWalker {
670670
private:
671671
unsigned TmpNameIndex = 0;
672-
TopLevelContext &TLC;
673672

674673
public:
675-
ExpressionFinder(TopLevelContext &TLC) : TLC(TLC) {}
674+
ExpressionFinder() = default;
676675

677676
bool walkToDeclPre(Decl *D) override {
678677
ASTContext &ctx = D->getASTContext();
@@ -702,7 +701,7 @@ void swift::performPCMacro(SourceFile &SF, TopLevelContext &TLC) {
702701
}
703702
};
704703

705-
ExpressionFinder EF(TLC);
704+
ExpressionFinder EF;
706705
for (Decl *D : SF.Decls) {
707706
D->walk(EF);
708707
}

0 commit comments

Comments
 (0)