File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -549,6 +549,13 @@ gatherConstValuesForModule(const std::unordered_set<std::string> &Protocols,
549
549
NominalTypeConformanceCollector ConformanceCollector (Protocols,
550
550
ConformanceDecls);
551
551
Module->walk (ConformanceCollector);
552
+ // Visit macro expanded extensions
553
+ for (auto *FU : Module->getFiles ())
554
+ if (auto *synthesizedSF = FU->getSynthesizedFile ())
555
+ for (auto D : synthesizedSF->getTopLevelDecls ())
556
+ if (isa<ExtensionDecl>(D))
557
+ D->walk (ConformanceCollector);
558
+
552
559
for (auto *CD : ConformanceDecls)
553
560
Result.emplace_back (evaluateOrDefault (CD->getASTContext ().evaluator ,
554
561
ConstantValueInfoRequest{CD, Module},
Original file line number Diff line number Diff line change 7
7
// RUN: %target-swift-frontend -typecheck -emit-const-values-path %t/ExtractFromMacroExpansion.swiftconstvalues -const-gather-protocols-file %t/protocols.json -primary-file %s -load-plugin-library %t/%target-library-name(MacroDefinition)
8
8
// RUN: cat %t/ExtractFromMacroExpansion.swiftconstvalues 2>&1 | %FileCheck %s
9
9
10
+ // Do the same, but ensure the WMO compilation flow produces the same result
11
+ // RUN: %target-swift-frontend -typecheck -emit-const-values-path %t/ExtractFromMacroExpansionWMO.swiftconstvalues -const-gather-protocols-file %t/protocols.json -O %s -load-plugin-library %t/%target-library-name(MacroDefinition)
12
+ // RUN: cat %t/ExtractFromMacroExpansionWMO.swiftconstvalues 2>&1 | %FileCheck %s
13
+
10
14
protocol MyProto { }
11
15
12
16
@freestanding ( declaration, names: named ( MacroAddedStruct) )
You can’t perform that action at this time.
0 commit comments