Skip to content

Commit f17671c

Browse files
committed
Guard a static assert for MSVC
MSVC doens't pack diffrent underlying int types into a bitfield. e.g. struct S { int a: 1; char b: 1; int c: 1; }; These fields are considered three sparate bitfields.
1 parent f8e10bb commit f17671c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "swift/AST/DiagnosticsParse.h"
2929
#include "swift/AST/DiagnosticsFrontend.h"
3030
#include "swift/AST/DiagnosticsSIL.h"
31+
#include "swift/Basic/Compiler.h"
3132
#include "swift/Basic/SourceManager.h"
3233
#include "swift/Demangling/ManglingUtils.h"
3334
#include "swift/Frontend/Frontend.h"
@@ -608,7 +609,13 @@ struct SwiftSemanticToken {
608609
return SwiftLangSupport::getUIDForCodeCompletionDeclKind(Kind, getIsRef());
609610
}
610611
};
612+
#if SWIFT_COMPILER_IS_MSVC
613+
#else
611614
static_assert(sizeof(SwiftSemanticToken) == 8, "Too big");
615+
// FIXME: MSVC doesn't pack bitfields with different underlying types.
616+
// Giving up to check this in MSVC for now, becasue static_assert is only for
617+
// keeping low memory usage.
618+
#endif
612619

613620
class SwiftDocumentSemanticInfo :
614621
public ThreadSafeRefCountedBase<SwiftDocumentSemanticInfo> {

0 commit comments

Comments
 (0)