From 6b5126ec1b226addd8648f66bb0af6df94f7e0e0 Mon Sep 17 00:00:00 2001 From: Hugh Bellamy Date: Fri, 18 Nov 2016 17:31:58 +0000 Subject: [PATCH 1/3] Fix MSVC errors building SemaAPINotes with MSVC --- lib/Sema/SemaAPINotes.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/Sema/SemaAPINotes.cpp b/lib/Sema/SemaAPINotes.cpp index cf88f735018..6173661d4ec 100644 --- a/lib/Sema/SemaAPINotes.cpp +++ b/lib/Sema/SemaAPINotes.cpp @@ -131,8 +131,7 @@ namespace { Sema &S, Decl *D, bool shouldAddAttribute, VersionedInfoRole role, llvm::function_ref createAttr, - llvm::function_ref(Decl *)> getExistingAttr = - [](Decl *decl) { return decl->specific_attr_begin(); }) { + llvm::function_ref(Decl *)> getExistingAttr) { switch (role) { case VersionedInfoRole::AugmentSource: // If we're not adding an attribute, there's nothing to do. @@ -168,6 +167,17 @@ namespace { break; } } + + template + void handleAPINotedAttribute( + Sema &S, Decl *D, bool shouldAddAttribute, + VersionedInfoRole role, + llvm::function_ref createAttr) { + handleAPINotedAttribute(S, D, shouldAddAttribute, role, createAttr, + [](Decl *decl) { + return decl->specific_attr_begin(); + }); + } } static void ProcessAPINotes(Sema &S, Decl *D, From 1d03955b9f0e99b572ace4b8e1f85ab4c3d8f228 Mon Sep 17 00:00:00 2001 From: jrose-apple Date: Fri, 18 Nov 2016 17:34:06 +0000 Subject: [PATCH 2/3] [Sema] Fix-up for MSVC, which is stricter about template types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@286525 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaType.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 3b8345f623b..567dfe6ba68 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -3522,7 +3522,7 @@ static void recordNullabilitySeen(Sema &S, SourceLocation loc) { S.Diag(fileNullability.PointerLoc, diag::warn_nullability_missing_array); } else { S.Diag(fileNullability.PointerLoc, diag::warn_nullability_missing) - << fileNullability.PointerKind; + << static_cast(fileNullability.PointerKind); } } From 377d4559df605b3a580bccfc5b05aed30f1b7fb0 Mon Sep 17 00:00:00 2001 From: Hugh Bellamy Date: Tue, 29 Nov 2016 16:35:37 +0000 Subject: [PATCH 3/3] Fix compiler crash building APINotesYAMLCompiler in swift-clang with MSVC --- lib/APINotes/APINotesYAMLCompiler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/APINotes/APINotesYAMLCompiler.cpp b/lib/APINotes/APINotesYAMLCompiler.cpp index 0ac0b6d65b7..337e76cea76 100644 --- a/lib/APINotes/APINotesYAMLCompiler.cpp +++ b/lib/APINotes/APINotesYAMLCompiler.cpp @@ -164,7 +164,7 @@ namespace { AvailabilityItem() : Mode(APIAvailability::Available), Msg("") {} }; - static llvm::Optional AbsentNullability = llvm::None; + static llvm::Optional AbsentNullability {}; static llvm::Optional DefaultNullability = NullabilityKind::NonNull; typedef std::vector NullabilitySeq;