Skip to content

Commit f66bbfb

Browse files
authored
Merge pull request #7613 from hughbe/msvc-static-assertion-failure
Fix MSVC static assertion failure in SourceKit
2 parents 444775f + 2cdee2f commit f66bbfb

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,17 +372,21 @@ struct SwiftSemanticToken {
372372
// The code-completion kinds are a good match for the semantic kinds we want.
373373
// FIXME: Maybe rename CodeCompletionDeclKind to a more general concept ?
374374
CodeCompletionDeclKind Kind : 6;
375-
bool IsRef : 1;
376-
bool IsSystem : 1;
375+
unsigned IsRef : 1;
376+
unsigned IsSystem : 1;
377377

378378
SwiftSemanticToken(CodeCompletionDeclKind Kind,
379379
unsigned ByteOffset, unsigned Length,
380380
bool IsRef, bool IsSystem)
381381
: ByteOffset(ByteOffset), Length(Length), Kind(Kind),
382382
IsRef(IsRef), IsSystem(IsSystem) { }
383383

384+
bool getIsRef() const { return static_cast<bool>(IsRef); }
385+
386+
bool getIsSystem() const { return static_cast<bool>(IsSystem); }
387+
384388
UIdent getUIdentForKind() const {
385-
return SwiftLangSupport::getUIDForCodeCompletionDeclKind(Kind, IsRef);
389+
return SwiftLangSupport::getUIDForCodeCompletionDeclKind(Kind, getIsRef());
386390
}
387391
};
388392
static_assert(sizeof(SwiftSemanticToken) == 8, "Too big");
@@ -1785,7 +1789,7 @@ void SwiftEditorDocument::readSemanticInfo(ImmutableTextSnapshotRef Snapshot,
17851789
unsigned Offset = SemaTok.ByteOffset;
17861790
unsigned Length = SemaTok.Length;
17871791
UIdent Kind = SemaTok.getUIdentForKind();
1788-
bool IsSystem = SemaTok.IsSystem;
1792+
bool IsSystem = SemaTok.getIsSystem();
17891793
if (Kind.isValid())
17901794
if (!Consumer.handleSemanticAnnotation(Offset, Length, Kind, IsSystem))
17911795
break;

0 commit comments

Comments
 (0)