File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed
lib/SILOptimizer/Mandatory
tools/SourceKit/lib/SwiftLang Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -150,6 +150,10 @@ class SILOptions {
150
150
// / Enables SIL-level diagnostics for NonescapableTypes.
151
151
bool EnableLifetimeDependenceDiagnostics = true ;
152
152
153
+ // / Enables SIL-level performance diagnostics (for @noLocks, @noAllocation
154
+ // / annotations and for Embedded Swift).
155
+ bool EnablePerformanceDiagnostics = true ;
156
+
153
157
// / Controls whether or not paranoid verification checks are run.
154
158
bool VerifyAll = false ;
155
159
Original file line number Diff line number Diff line change @@ -805,9 +805,10 @@ class PerformanceDiagnosticsPass : public SILModuleTransform {
805
805
void run () override {
806
806
SILModule *module = getModule ();
807
807
808
- // Skip all performance/embedded diagnostics if not in WMO mode. Building in
809
- // non-WMO mode currently results in false positives.
810
- if (!module ->isWholeModule ()) return ;
808
+ // Skip all performance/embedded diagnostics if asked. This is used from
809
+ // SourceKit to avoid reporting false positives when WMO is turned off for
810
+ // indexing purposes.
811
+ if (!module ->getOptions ().EnablePerformanceDiagnostics ) return ;
811
812
812
813
PerformanceDiagnostics diagnoser (*module , getAnalysis<BasicCalleeAnalysis>());
813
814
Original file line number Diff line number Diff line change @@ -1219,6 +1219,11 @@ ASTUnitRef ASTBuildOperation::buildASTUnit(std::string &Error) {
1219
1219
// flag and might thus fail, which SILGen cannot handle.
1220
1220
llvm::SaveAndRestore<std::shared_ptr<std::atomic<bool >>> DisableCancellationDuringSILGen (CompIns.getASTContext ().CancellationFlag , nullptr );
1221
1221
SILOptions SILOpts = Invocation.getSILOptions ();
1222
+
1223
+ // Disable PerformanceDiagnostics SIL pass, which in some cases requires
1224
+ // WMO (e.g. for Embedded Swift diags) but SourceKit compiles without WMO.
1225
+ SILOpts.EnablePerformanceDiagnostics = false ;
1226
+
1222
1227
auto &TC = CompIns.getSILTypes ();
1223
1228
std::unique_ptr<SILModule> SILMod = performASTLowering (*SF, TC, SILOpts);
1224
1229
if (CancellationFlag->load (std::memory_order_relaxed)) {
You can’t perform that action at this time.
0 commit comments