Skip to content

Commit 5992292

Browse files
committed
---
yaml --- r: 210442 b: refs/heads/swift-5.0-branch c: 8c4c186 h: refs/heads/master
1 parent d1efa03 commit 5992292

File tree

5 files changed

+23
-10
lines changed

5 files changed

+23
-10
lines changed

Diff for: [refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2017-12-23-a: b7c074342459a645779f106c42bf4
644644
refs/heads/master-llvm-swift5-transition: 8ace18c8953afb3d7d94cf04cacc0b51a7e5f1e3
645645
"refs/heads/revert-12883-disable_modelio_test_ios": a77ae373b809a0d8cb460cf3d1585d618510d242
646646
refs/heads/revert-13597-master: cccee1df039d072215f9bddc2cbc1e32a8d5d5ee
647-
refs/heads/swift-5.0-branch: b78987a8c53597e853804452885f9c1f86620cdf
647+
refs/heads/swift-5.0-branch: 8c4c1863fca9ebab8d41f7b59437e9f5279b00c7
648648
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2017-12-23-a: b32214f7e04339dfada623b6b76dbebfb41e4541
649649
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2017-12-24-a: 1eb0be506c0744c7eff0550a10240286046e181d
650650
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2017-12-25-a: f35a91502bad0065c83d8760407c23be7b899f48
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
_ = unknown
2+
// code-completion at 2:1

Diff for: branches/swift-5.0-branch/test/SourceKit/CompileNotifications/diagnostics.swift

+5
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,8 @@
3838
// CLANG_IMPORTER-NEXT: key.filepath: "<{{.*}}>"
3939
// CLANG_IMPORTER-NEXT: key.severity: source.diagnostic.severity.error,
4040
// CLANG_IMPORTER-NEXT: key.description: {{.*}}not found
41+
42+
// Note: we're missing the "compiler is in code completion mode" diagnostic,
43+
// which is probably just as well.
44+
// RUN: %sourcekitd-test -req=track-compiles == -req=complete -offset=0 %s -- %s | %FileCheck %s -check-prefix=NODIAGS
45+
// RUN: %sourcekitd-test -req=track-compiles == -req=complete -pos=2:1 %S/Inputs/sema-error.swift -- %S/Inputs/sema-error.swift | %FileCheck %s -check-prefix=SEMA

Diff for: branches/swift-5.0-branch/tools/SourceKit/lib/SwiftLang/SwiftCompletion.cpp

+14-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "CodeCompletionOrganizer.h"
1414
#include "SwiftASTManager.h"
1515
#include "SwiftLangSupport.h"
16+
#include "SwiftEditorDiagConsumer.h"
1617
#include "SourceKit/Support/Logging.h"
1718
#include "SourceKit/Support/UIdent.h"
1819

@@ -138,6 +139,12 @@ static bool swiftCodeCompleteImpl(SwiftLangSupport &Lang,
138139
PrintingDiagnosticConsumer PrintDiags;
139140
CI.addDiagnosticConsumer(&PrintDiags);
140141

142+
EditorDiagConsumer TraceDiags;
143+
trace::TracedOperation TracedOp(trace::OperationKind::CodeCompletion);
144+
if (TracedOp.enabled()) {
145+
CI.addDiagnosticConsumer(&TraceDiags);
146+
}
147+
141148
CompilerInvocation Invocation;
142149
bool Failed = Lang.getASTManager().initCompilerInvocation(
143150
Invocation, Args, CI.getDiags(), InputFile->getBufferIdentifier(), Error);
@@ -188,8 +195,6 @@ static bool swiftCodeCompleteImpl(SwiftLangSupport &Lang,
188195

189196
TracedInit.finish();
190197

191-
192-
trace::TracedOperation TracedOp(trace::OperationKind::CodeCompletion);
193198
if (TracedOp.enabled()) {
194199
trace::SwiftInvocation SwiftArgs;
195200
trace::initTraceInfo(SwiftArgs, InputFile->getBufferIdentifier(), Args);
@@ -215,6 +220,13 @@ static bool swiftCodeCompleteImpl(SwiftLangSupport &Lang,
215220
&CompletionContext);
216221
CI.performSema();
217222
SwiftConsumer.clearContext();
223+
224+
if (TracedOp.enabled()) {
225+
SmallVector<DiagnosticEntryInfo, 8> Diagnostics;
226+
TraceDiags.getAllDiagnostics(Diagnostics);
227+
TracedOp.finish(Diagnostics);
228+
}
229+
218230
return true;
219231
}
220232

Diff for: branches/swift-5.0-branch/tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp

+2-7
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,10 @@ void EditorDiagConsumer::handleDiagnostic(
114114
if (!isInputBufferID(BufferID)) {
115115
if (Info.ID == diag::error_from_clang.ID ||
116116
Info.ID == diag::warning_from_clang.ID ||
117-
Info.ID == diag::note_from_clang.ID) {
117+
Info.ID == diag::note_from_clang.ID ||
118+
!IsNote) {
118119
// Handle it as other diagnostics.
119120
} else {
120-
if (!IsNote) {
121-
LOG_WARN_FUNC("got swift diagnostic not pointing at input file, "
122-
"buffer name: " << SM.getIdentifierForBuffer(BufferID));
123-
return;
124-
}
125-
126121
// FIXME: This is a note pointing to a synthesized declaration buffer for
127122
// a declaration coming from a module.
128123
// We should include the Decl* in the DiagnosticInfo and have a way for

0 commit comments

Comments
 (0)