mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Serialization|NFC] Move free floating functions to methods
Move some deserialization error handling services to methods under ModuleFile. This will give access to the ASTContext and allow to report diagnostics. Also rename `consumeErrorIfXRefNonLoadedModule` into the more general `consumeExpectedError` that is more appropriate for future improvements.
This commit is contained in:
@@ -341,6 +341,12 @@ private:
|
||||
template <typename T, typename ...Args>
|
||||
T *createDecl(Args &&... args);
|
||||
|
||||
Decl *handleErrorAndSupplyMissingMiscMember(llvm::Error &&error) const;
|
||||
|
||||
Decl *handleErrorAndSupplyMissingMember(ASTContext &context,
|
||||
Decl *container,
|
||||
llvm::Error &&error) const;
|
||||
|
||||
public:
|
||||
/// Change the status of the current module.
|
||||
Status error(Status issue) {
|
||||
@@ -404,6 +410,13 @@ public:
|
||||
return llvm::consumeError(diagnoseFatal(msg));
|
||||
}
|
||||
|
||||
/// Consume errors that are usually safe to ignore because they
|
||||
/// are expected to support language features or caused by project
|
||||
/// misconfigurations.
|
||||
///
|
||||
/// If the error is handled, success is returned, otherwise the original
|
||||
/// error is returned.
|
||||
llvm::Error consumeExpectedError(llvm::Error &&error);
|
||||
|
||||
/// Report an unexpected format error that could happen only from a
|
||||
/// memory-level inconsistency. Please prefer passing an error to
|
||||
|
||||
Reference in New Issue
Block a user