Skip to content

Commit 01f3be2

Browse files
authored
Merge pull request #75842 from ahoppen/ast-consumer-failed-pure-virtual
[SourceKit] Make `SwiftASTConsumer::failed` pure virtual
2 parents 36dee56 + 84c0d13 commit 01f3be2

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

tools/SourceKit/lib/SwiftLang/SwiftASTManager.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ using namespace SourceKit;
4242
using namespace swift;
4343
using namespace swift::sys;
4444

45-
void SwiftASTConsumer::failed(StringRef Error) { }
46-
4745
//===----------------------------------------------------------------------===//
4846
// SwiftInvocation
4947
//===----------------------------------------------------------------------===//

tools/SourceKit/lib/SwiftLang/SwiftASTManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ class SwiftASTConsumer : public std::enable_shared_from_this<SwiftASTConsumer> {
223223

224224
/// Creation of the AST failed due to \p Error. The request corresponding to
225225
/// this consumer should fail.
226-
virtual void failed(StringRef Error);
226+
virtual void failed(StringRef Error) = 0;
227227

228228
/// The consumer was cancelled by the \c requestCancellation method and the \c
229229
/// ASTBuildOperation creating the AST for this consumer honored the request.

tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2633,6 +2633,11 @@ void SwiftLangSupport::getSemanticTokens(
26332633
void cancelled() override {
26342634
Receiver(RequestResult<SemanticTokensResult>::cancelled());
26352635
}
2636+
2637+
void failed(StringRef Error) override {
2638+
LOG_WARN_FUNC("semantic tokens failed: " << Error);
2639+
Receiver(RequestResult<SemanticTokensResult>::fromError(Error));
2640+
}
26362641
};
26372642

26382643
auto Consumer = std::make_shared<SemanticTokensConsumer>(InputBufferName,

tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1811,6 +1811,11 @@ static void computeDiagnostics(
18111811
void cancelled() override {
18121812
Receiver(RequestResult<DiagnosticsResult>::cancelled());
18131813
}
1814+
1815+
void failed(StringRef Error) override {
1816+
LOG_WARN_FUNC("diagnostics failed: " << Error);
1817+
Receiver(RequestResult<DiagnosticsResult>::fromError(Error));
1818+
}
18141819
};
18151820

18161821
auto Consumer = std::make_shared<DiagnosticsConsumer>(std::move(Receiver));

0 commit comments

Comments
 (0)