Skip to content

Commit

Permalink
[AST Verifier] Don't deserialize protocol conformances just to verify…
Browse files Browse the repository at this point in the history
… them.

Fixes rdar://problem/24922889.
  • Loading branch information
DougGregor committed Mar 2, 2016
1 parent 0fe865a commit 659811e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/swift/AST/ProtocolConformance.h
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,11 @@ class NormalProtocolConformance : public ProtocolConformance,
ContextAndInvalid.setInt(true);
}

/// Determine whether this conformance is lazily resolved.
///
/// This only matters to the AST verifier.
bool isLazilyResolved() const { return Resolver != nullptr; }

/// True if the conformance describes a property behavior.
bool isBehaviorConformance() const {
return ContextAndInvalid.getPointer().is<AbstractStorageDecl *>();
Expand Down
4 changes: 4 additions & 0 deletions lib/AST/ASTVerifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1734,6 +1734,10 @@ struct ASTNodeBase {};
if (!normal)
return;

// If the conformance is lazily resolved, don't check it; that can cause
// massive deserialization at a point where the compiler cannot handle it.
if (normal->isLazilyResolved()) return;

// Translate the owning declaration into a DeclContext.
NominalTypeDecl *nominal = dyn_cast<NominalTypeDecl>(decl);
DeclContext *conformingDC;
Expand Down

0 comments on commit 659811e

Please sign in to comment.