Verify deserialized Swift decls as well as imported Clang decls.

Like the Clang decls, this happens at the end of the type-checking, just as
a simple walk through the loaded decls of the loaded modules. This caught
all of the issues in this commit series and will hopefully keep us honest in
the future.

(By the way, we don't verify right when we return a deserialized decl for the
same reason we don't verify right when we return an imported decl: parts of
the decl may be delayed, and (a) we don't want to force things to be imported
or deserialized sooner than necessary, yet (b) we want to verify as much as
possible.)

rdar://problem/16968891

Swift SVN r22200
This commit is contained in:
Jordan Rose
2014-09-23 02:06:27 +00:00
parent 988b8c2033
commit a49874afb5
7 changed files with 55 additions and 19 deletions

View File

@@ -469,6 +469,28 @@ public:
return ModuleInputBuffer->getBufferIdentifier();
}
/// AST-verify imported decls.
///
/// Has no effect in NDEBUG builds.
void verify() const;
virtual ArrayRef<Decl *> loadAllMembers(const Decl *D,
uint64_t contextData,
bool *ignored) override;
virtual ArrayRef<ProtocolConformance *>
loadAllConformances(const Decl *D, uint64_t contextData) override;
virtual TypeLoc loadAssociatedTypeDefault(const AssociatedTypeDecl *ATD,
uint64_t contextData) override;
Optional<BriefAndRawComment> getCommentForDecl(const Decl *D);
Optional<BriefAndRawComment> getCommentForDeclByUSR(StringRef USR);
Identifier getDiscriminatorForPrivateValue(const ValueDecl *D);
// MARK: Deserialization interface
llvm::BitstreamCursor getSILCursor() const {
return SILCursor;
}
@@ -533,21 +555,6 @@ public:
GenericParamList *maybeReadGenericParams(DeclContext *DC,
llvm::BitstreamCursor &Cursor,
GenericParamList *outerParams = nullptr);
virtual ArrayRef<Decl *> loadAllMembers(const Decl *D,
uint64_t contextData,
bool *ignored) override;
virtual ArrayRef<ProtocolConformance *>
loadAllConformances(const Decl *D, uint64_t contextData) override;
virtual TypeLoc loadAssociatedTypeDefault(const AssociatedTypeDecl *ATD,
uint64_t contextData) override;
Optional<BriefAndRawComment> getCommentForDecl(const Decl *D);
Optional<BriefAndRawComment> getCommentForDeclByUSR(StringRef USR);
Identifier getDiscriminatorForPrivateValue(const ValueDecl *D);
};
} // end namespace swift