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

Fix building specific Swift files in swift-clang with MSVC #45

Merged
merged 3 commits into from
Dec 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/APINotes/APINotesYAMLCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ namespace {
AvailabilityItem() : Mode(APIAvailability::Available), Msg("") {}
};

static llvm::Optional<NullabilityKind> AbsentNullability = llvm::None;
static llvm::Optional<NullabilityKind> AbsentNullability {};
static llvm::Optional<NullabilityKind> DefaultNullability =
NullabilityKind::NonNull;
typedef std::vector<clang::NullabilityKind> NullabilitySeq;
Expand Down
14 changes: 12 additions & 2 deletions lib/Sema/SemaAPINotes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ namespace {
Sema &S, Decl *D, bool shouldAddAttribute,
VersionedInfoRole role,
llvm::function_ref<A *()> createAttr,
llvm::function_ref<specific_attr_iterator<A>(Decl *)> getExistingAttr =
[](Decl *decl) { return decl->specific_attr_begin<A>(); }) {
llvm::function_ref<specific_attr_iterator<A>(Decl *)> getExistingAttr) {
switch (role) {
case VersionedInfoRole::AugmentSource:
// If we're not adding an attribute, there's nothing to do.
Expand Down Expand Up @@ -168,6 +167,17 @@ namespace {
break;
}
}

template<typename A>
void handleAPINotedAttribute(
Sema &S, Decl *D, bool shouldAddAttribute,
VersionedInfoRole role,
llvm::function_ref<A *()> createAttr) {
handleAPINotedAttribute<A>(S, D, shouldAddAttribute, role, createAttr,
[](Decl *decl) {
return decl->specific_attr_begin<A>();
});
}
}

static void ProcessAPINotes(Sema &S, Decl *D,
Expand Down
2 changes: 1 addition & 1 deletion lib/Sema/SemaType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<unsigned>(fileNullability.PointerKind);
}
}

Expand Down