Skip to content

Fix errors and warnings building swift/SILGen on Windows using MSVC #5955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 22, 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
4 changes: 2 additions & 2 deletions include/swift/SIL/SILArgumentConvention.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ enum class InoutAliasingAssumption {
/// By design, this is exactly the same as ParameterConvention, plus
/// Indirect_Out.
struct SILArgumentConvention {
enum : uint8_t {
enum ConventionType : uint8_t {
Indirect_In,
Indirect_In_Guaranteed,
Indirect_Inout,
Expand Down Expand Up @@ -79,7 +79,7 @@ struct SILArgumentConvention {
llvm_unreachable("covered switch isn't covered?!");
}

operator decltype(Value)() const { return Value; }
operator ConventionType() const { return Value; }

bool isIndirectConvention() const {
return Value <= SILArgumentConvention::Indirect_Out;
Expand Down
1 change: 0 additions & 1 deletion include/swift/SILOptimizer/PassManager/PassPipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class SILPassPipelinePlan final {
SILPassPipelinePlan() = default;
~SILPassPipelinePlan() = default;
SILPassPipelinePlan(const SILPassPipelinePlan &) = default;
SILPassPipelinePlan(SILPassPipelinePlan &&) = delete;

// Each pass gets its own add-function.
#define PASS(ID, NAME, DESCRIPTION) \
Expand Down
2 changes: 2 additions & 0 deletions lib/SILGen/ArgumentSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ bool ArgumentSource::requiresCalleeToEvaluate() {
case Kind::Expr:
return isa<TupleShuffleExpr>(asKnownExpr());
}

llvm_unreachable("Unhandled Kind in switch.");
}

RValue ArgumentSource::getAsRValue(SILGenFunction &gen, SGFContext C) && {
Expand Down
2 changes: 2 additions & 0 deletions lib/SILGen/RValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ class ImplodeLoadableTupleValue
case ImplodeKind::Copy:
return v.copyUnmanaged(gen, l).forward(gen);
}

llvm_unreachable("Unhandled ImplodeKind in switch.");
}

ImplodeLoadableTupleValue(ArrayRef<ManagedValue> values,
Expand Down
9 changes: 7 additions & 2 deletions lib/SILGen/SILGenApply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,8 @@ class Callee {
case Kind::DynamicMethod:
return Constant.uncurryLevel;
}

llvm_unreachable("Unhandled Kind in switch.");
}

EnumElementDecl *getEnumElementDecl() {
Expand Down Expand Up @@ -1487,7 +1489,7 @@ class SILGenApply : public Lowering::ExprVisitor<SILGenApply> {

Callee getCallee() {
assert(ApplyCallee && "did not find callee?!");
return *std::move(ApplyCallee);
return std::move(*ApplyCallee);
}

/// Ignore parentheses and implicit conversions.
Expand Down Expand Up @@ -3633,7 +3635,10 @@ void ArgEmitter::emitShuffle(Expr *inner,
// fill out varargsAddrs if necessary.
for (auto &extent : innerExtents) {
assert(extent.Used && "didn't use all the inner tuple elements!");
innerParams.append(extent.Params.begin(), extent.Params.end());

for (auto param : extent.Params) {
innerParams.push_back(param);
}

// Fill in the special destinations array.
if (innerSpecialDests) {
Expand Down
2 changes: 2 additions & 0 deletions lib/SILGen/SILGenConvert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,8 @@ ManagedValue SILGenFunction::emitExistentialErasure(
return manageBufferForExprResult(existential, existentialTL, C);
}
}

llvm_unreachable("Unhandled ExistentialRepresentation in switch.");
}

ManagedValue SILGenFunction::emitClassMetatypeToObject(SILLocation loc,
Expand Down
2 changes: 2 additions & 0 deletions lib/SILGen/SILGenExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2091,6 +2091,8 @@ visitMagicIdentifierLiteralExpr(MagicIdentifierLiteralExpr *E, SGFContext C) {
return RValue(SGF, E, ManagedValue::forUnmanaged(UnsafeRawPtrStruct));
}
}

llvm_unreachable("Unhandled MagicIdentifierLiteralExpr in switch.");
}

RValue RValueEmitter::visitCollectionExpr(CollectionExpr *E, SGFContext C) {
Expand Down
2 changes: 2 additions & 0 deletions lib/SILGen/SILGenFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ DeclName SILGenModule::getMagicFunctionName(SILDeclRef ref) {
return getMagicFunctionName(cast<EnumElementDecl>(ref.getDecl())
->getDeclContext());
}

llvm_unreachable("Unhandled SILDeclRefKind in switch.");
}

SILValue SILGenFunction::emitGlobalFunctionRef(SILLocation loc,
Expand Down
4 changes: 4 additions & 0 deletions lib/SILGen/SILGenPattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ static bool isWildcardPattern(const Pattern *p) {
case PatternKind::Var:
return isWildcardPattern(p->getSemanticsProvidingPattern());
}

llvm_unreachable("Unhandled PatternKind in switch.");
}

/// Check to see if the given pattern is a specializing pattern,
Expand Down Expand Up @@ -284,6 +286,8 @@ static Pattern *getSimilarSpecializingPattern(Pattern *p, Pattern *first) {
case PatternKind::Typed:
llvm_unreachable("not semantic");
}

llvm_unreachable("Unhandled PatternKind in switch.");
}

namespace {
Expand Down
4 changes: 4 additions & 0 deletions lib/SILGen/SILGenPoly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2788,6 +2788,8 @@ getWitnessFunctionType(SILGenModule &SGM,
case WitnessDispatchKind::Class:
return SGM.Types.getConstantOverrideType(witness);
}

llvm_unreachable("Unhandled WitnessDispatchKind in switch.");
}

static SILValue
Expand All @@ -2808,6 +2810,8 @@ getWitnessFunctionRef(SILGenFunction &gen,
SILValue selfPtr = witnessParams.back().getValue();
return gen.B.createClassMethod(loc, selfPtr, witness);
}

llvm_unreachable("Unhandled WitnessDispatchKind in switch.");
}

static CanType dropLastElement(CanType type) {
Expand Down
4 changes: 4 additions & 0 deletions lib/SILGen/SILGenProfiling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ class CounterExpr {
case Kind::Ref:
return LHS->expand(Builder, Counters);
}

llvm_unreachable("Unhandled Kind in switch.");
}
};

Expand Down Expand Up @@ -694,6 +696,8 @@ getEquivalentPGOLinkage(FormalLinkage Linkage) {
case FormalLinkage::Private:
return llvm::GlobalValue::PrivateLinkage;
}

llvm_unreachable("Unhandled FormalLinkage in switch.");
}

void SILGenProfiling::assignRegionCounters(Decl *Root) {
Expand Down
2 changes: 1 addition & 1 deletion lib/SILOptimizer/IPO/CapturePromotion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ static std::string getSpecializedName(SILFunction *F,
IsFragile_t Fragile,
IndicesSet &PromotableIndices) {
Mangle::Mangler M;
auto P = SpecializationPass::CapturePromotion;
auto P = Demangle::SpecializationPass::CapturePromotion;
FunctionSignatureSpecializationMangler OldFSSM(P, M, Fragile, F);
NewMangling::FunctionSignatureSpecializationMangler NewFSSM(P, Fragile, F);
CanSILFunctionType FTy = F->getLoweredFunctionType();
Expand Down
2 changes: 1 addition & 1 deletion lib/SILOptimizer/IPO/CapturePropagation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static std::string getClonedName(PartialApplyInst *PAI, IsFragile_t Fragile,
SILFunction *F) {

Mangle::Mangler M;
auto P = SpecializationPass::CapturePropagation;
auto P = Demangle::SpecializationPass::CapturePropagation;
FunctionSignatureSpecializationMangler OldMangler(P, M, Fragile, F);
NewMangling::FunctionSignatureSpecializationMangler NewMangler(P, Fragile, F);

Expand Down
2 changes: 1 addition & 1 deletion lib/SILOptimizer/IPO/ClosureSpecializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ IsFragile_t CallSiteDescriptor::isFragile() const {

std::string CallSiteDescriptor::createName() const {
Mangle::Mangler M;
auto P = SpecializationPass::ClosureSpecializer;
auto P = Demangle::SpecializationPass::ClosureSpecializer;
FunctionSignatureSpecializationMangler OldFSSM(P, M, isFragile(),
getApplyCallee());
NewMangling::FunctionSignatureSpecializationMangler NewFSSM(P, isFragile(),
Expand Down
4 changes: 4 additions & 0 deletions lib/SILOptimizer/PassManager/Passes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ StringRef swift::PassKindName(PassKind Kind) {
case PassKind::invalidPassKind:
llvm_unreachable("Invalid pass kind?!");
}

llvm_unreachable("Unhandled PassKind in switch.");
}

StringRef swift::PassKindID(PassKind Kind) {
Expand All @@ -157,4 +159,6 @@ StringRef swift::PassKindID(PassKind Kind) {
case PassKind::invalidPassKind:
llvm_unreachable("Invalid pass kind?!");
}

llvm_unreachable("Unhandled PassKind in switch.");
}
2 changes: 1 addition & 1 deletion lib/SILOptimizer/Transforms/AllocBoxToStack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ static std::string getClonedName(SILFunction *F,
IsFragile_t Fragile,
ParamIndexList &PromotedParamIndices) {
Mangle::Mangler M;
auto P = SpecializationPass::AllocBoxToStack;
auto P = Demangle::SpecializationPass::AllocBoxToStack;
FunctionSignatureSpecializationMangler OldFSSM(P, M, Fragile, F);
NewMangling::FunctionSignatureSpecializationMangler NewFSSM(P, Fragile, F);
for (unsigned i : PromotedParamIndices) {
Expand Down
2 changes: 1 addition & 1 deletion lib/SILOptimizer/Transforms/FunctionSignatureOpts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ class FunctionSignatureOpts : public SILFunctionTransform {
// going to change, make sure the mangler is aware of all the changes done
// to the function.
Mangle::Mangler M;
auto P = SpecializationPass::FunctionSignatureOpts;
auto P = Demangle::SpecializationPass::FunctionSignatureOpts;
FunctionSignatureSpecializationMangler OldFM(P, M, F->isFragile(), F);
NewMangling::FunctionSignatureSpecializationMangler NewFM(P, F->isFragile(),
F);
Expand Down
2 changes: 1 addition & 1 deletion lib/SILOptimizer/Utils/SpecializationMangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ std::string PartialSpecializationMangler::mangle() {
//===----------------------------------------------------------------------===//

FunctionSignatureSpecializationMangler::
FunctionSignatureSpecializationMangler(SpecializationPass P,
FunctionSignatureSpecializationMangler(Demangle::SpecializationPass P,
IsFragile_t Fragile, SILFunction *F)
: SpecializationMangler(P, Fragile, F) {
for (unsigned i = 0, e = F->getLoweredFunctionType()->getNumSILArguments();
Expand Down