Skip to content

Commit aafc973

Browse files
committed
[Deserialization] Verify that the module that PM handles is valid.
This commit makes the pass manager verify the module that it needs to handle before the transformations start. This verification only happens in debug mode. The new assertion catches a few errors in our test suite. I filed rdar://23667534 and disabled the failing deserialization tests. rdar://23667534
1 parent bc42387 commit aafc973

File tree

6 files changed

+14
-1
lines changed

6 files changed

+14
-1
lines changed

lib/SILPasses/PassManager/PassManager.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,13 @@ static void printModule(SILModule *Mod, bool EmitVerboseSIL) {
146146

147147
SILPassManager::SILPassManager(SILModule *M, llvm::StringRef Stage) :
148148
Mod(M), StageName(Stage) {
149-
149+
150+
#ifndef NDEBUG
151+
// Check that the module that the pass manager is asked to process is
152+
// valid.
153+
Mod->verify();
154+
#endif
155+
150156
#define ANALYSIS(NAME) \
151157
Analysis.push_back(create##NAME##Analysis(Mod));
152158
#include "swift/SILAnalysis/Analysis.def"

test/SIL/Serialization/deserialize_appkit.sil

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@
55
// REQUIRES: objc_interop
66
// REQUIRES: OS=macosx
77

8+
// REQUIRES: rdar://23667534
9+
10+
811
// CHECK-NOT: Unknown

test/SIL/Serialization/deserialize_coregraphics.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
// RUN: llvm-bcanalyzer %platform-sdk-overlay-dir/CoreGraphics.swiftmodule | FileCheck %s
44

55
// REQUIRES: objc_interop
6+
// REQUIRES: rdar://23667534
67

78
// CHECK-NOT: Unknown

test/SIL/Serialization/deserialize_darwin.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
// RUN: llvm-bcanalyzer %platform-sdk-overlay-dir/Darwin.swiftmodule | FileCheck %s
44

55
// REQUIRES: objc_interop
6+
// REQUIRES: rdar://23667534
67

78
// CHECK-NOT: Unknown

test/SIL/Serialization/deserialize_foundation.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
// RUN: llvm-bcanalyzer %platform-sdk-overlay-dir/Foundation.swiftmodule | FileCheck %s
44

55
// REQUIRES: objc_interop
6+
// REQUIRES: rdar://23667534
67

78
// CHECK-NOT: Unknown

test/SIL/Serialization/deserialize_objectivec.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
// RUN: llvm-bcanalyzer %platform-sdk-overlay-dir/ObjectiveC.swiftmodule | FileCheck %s
44

55
// REQUIRES: objc_interop
6+
// REQUIRES: rdar://23667534
67

78
// CHECK-NOT: Unknown

0 commit comments

Comments
 (0)