Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit 2761f03

Browse files
authored
Merge pull request #45 from hughbe/msv-fixes
Fix building specific Swift files in swift-clang with MSVC
2 parents e8fe3e1 + 377d455 commit 2761f03

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

lib/APINotes/APINotesYAMLCompiler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ namespace {
164164
AvailabilityItem() : Mode(APIAvailability::Available), Msg("") {}
165165
};
166166

167-
static llvm::Optional<NullabilityKind> AbsentNullability = llvm::None;
167+
static llvm::Optional<NullabilityKind> AbsentNullability {};
168168
static llvm::Optional<NullabilityKind> DefaultNullability =
169169
NullabilityKind::NonNull;
170170
typedef std::vector<clang::NullabilityKind> NullabilitySeq;

lib/Sema/SemaAPINotes.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,7 @@ namespace {
131131
Sema &S, Decl *D, bool shouldAddAttribute,
132132
VersionedInfoRole role,
133133
llvm::function_ref<A *()> createAttr,
134-
llvm::function_ref<specific_attr_iterator<A>(Decl *)> getExistingAttr =
135-
[](Decl *decl) { return decl->specific_attr_begin<A>(); }) {
134+
llvm::function_ref<specific_attr_iterator<A>(Decl *)> getExistingAttr) {
136135
switch (role) {
137136
case VersionedInfoRole::AugmentSource:
138137
// If we're not adding an attribute, there's nothing to do.
@@ -168,6 +167,17 @@ namespace {
168167
break;
169168
}
170169
}
170+
171+
template<typename A>
172+
void handleAPINotedAttribute(
173+
Sema &S, Decl *D, bool shouldAddAttribute,
174+
VersionedInfoRole role,
175+
llvm::function_ref<A *()> createAttr) {
176+
handleAPINotedAttribute<A>(S, D, shouldAddAttribute, role, createAttr,
177+
[](Decl *decl) {
178+
return decl->specific_attr_begin<A>();
179+
});
180+
}
171181
}
172182

173183
static void ProcessAPINotes(Sema &S, Decl *D,

lib/Sema/SemaType.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3522,7 +3522,7 @@ static void recordNullabilitySeen(Sema &S, SourceLocation loc) {
35223522
S.Diag(fileNullability.PointerLoc, diag::warn_nullability_missing_array);
35233523
} else {
35243524
S.Diag(fileNullability.PointerLoc, diag::warn_nullability_missing)
3525-
<< fileNullability.PointerKind;
3525+
<< static_cast<unsigned>(fileNullability.PointerKind);
35263526
}
35273527
}
35283528

0 commit comments

Comments
 (0)