Fix errors and warnings building swift/IDE on Windows using MSVC

This commit is contained in:
Hugh Bellamy
2016-11-17 17:50:15 +00:00
parent b34d8e340c
commit d8fbaa01eb
3 changed files with 24 additions and 6 deletions

View File

@@ -1107,6 +1107,8 @@ CodeCompletionResult *CodeCompletionResultBuilder::takeResult() {
CodeCompletionResult(*LiteralKind, SemanticContext, NumBytesToErase,
CCS, ExpectedTypeRelation);
}
llvm_unreachable("Unhandled CodeCompletionResult in switch.");
}
void CodeCompletionResultBuilder::finishResult() {
@@ -1517,6 +1519,8 @@ protocolForLiteralKind(CodeCompletionLiteralKind kind) {
case CodeCompletionLiteralKind::Tuple:
llvm_unreachable("no such protocol kind");
}
llvm_unreachable("Unhandled CodeCompletionLiteralKind in switch.");
}
/// Whether funcType has a single argument (not including defaulted arguments)
@@ -2195,6 +2199,8 @@ public:
// these parameters.
return true;
}
llvm_unreachable("Unhandled DefaultArgumentKind in switch.");
};
// Do not desugar AFT->getInput(), as we want to treat (_: (a,b)) distinctly
@@ -2368,6 +2374,8 @@ public:
case LookupKind::ImportFromModule:
return false;
}
llvm_unreachable("Unhandled LookupKind in switch.");
}
void addMethodCall(const FuncDecl *FD, DeclVisibilityKind Reason) {
@@ -5075,7 +5083,7 @@ void CodeCompletionCallbacksImpl::doneParsing() {
if (isDynamicLookup(*ExprType))
Lookup.setIsDynamicLookup();
CodeCompletionTypeContextAnalyzer TypeAnalyzer(CurDeclContext, ParsedExpr);
::CodeCompletionTypeContextAnalyzer TypeAnalyzer(CurDeclContext, ParsedExpr);
llvm::SmallVector<Type, 2> PossibleTypes;
if (TypeAnalyzer.Analyze(PossibleTypes)) {
Lookup.setExpectedTypes(PossibleTypes);
@@ -5089,7 +5097,7 @@ void CodeCompletionCallbacksImpl::doneParsing() {
break;
case CompletionKind::PostfixExprBeginning: {
CodeCompletionTypeContextAnalyzer Analyzer(CurDeclContext,
::CodeCompletionTypeContextAnalyzer Analyzer(CurDeclContext,
CodeCompleteTokenExpr);
llvm::SmallVector<Type, 1> Types;
if (Analyzer.Analyze(Types)) {
@@ -5111,7 +5119,7 @@ void CodeCompletionCallbacksImpl::doneParsing() {
case CompletionKind::PostfixExprParen: {
Lookup.setHaveLParen(true);
CodeCompletionTypeContextAnalyzer TypeAnalyzer(CurDeclContext,
::CodeCompletionTypeContextAnalyzer TypeAnalyzer(CurDeclContext,
CodeCompleteTokenExpr);
SmallVector<Type, 2> PossibleTypes;
SmallVector<StringRef, 2> PossibleNames;
@@ -5332,8 +5340,10 @@ void CodeCompletionCallbacksImpl::doneParsing() {
AccessPath, Request.NeedLeadingDot,
SF.hasTestableImport(TheModule),
Ctx.LangOpts.CodeCompleteInitsInPostfixExpr};
std::pair<decltype(ImportsSeen)::iterator, bool>
Result = ImportsSeen.insert(K);
using PairType = llvm::DenseSet<swift::ide::CodeCompletionCache::Key,
llvm::DenseMapInfo<CodeCompletionCache::Key>>::iterator;
std::pair<PairType, bool> Result = ImportsSeen.insert(K);
if (!Result.second)
return; // already handled.
@@ -5485,6 +5495,8 @@ void swift::ide::copyCodeCompletionResults(CodeCompletionResultSink &targetSink,
case CodeCompletionDeclKind::GlobalVar:
return false;
}
llvm_unreachable("Unhandled CodeCompletionDeclKind in switch.");
});
} else {
targetSink.Results.insert(targetSink.Results.end(),

View File

@@ -358,7 +358,7 @@ static void writeCachedModule(llvm::raw_ostream &out,
if (R->getKind() == CodeCompletionResult::Declaration)
LE.write(static_cast<uint8_t>(R->getAssociatedDeclKind()));
else
LE.write(static_cast<uint8_t>(~0u));
LE.write(~static_cast<uint8_t>(0u));
if (R->isOperator())
LE.write(static_cast<uint8_t>(R->getOperatorKind()));
else

View File

@@ -216,6 +216,8 @@ public:
case LookupKind::Crawler:
return nullptr;
}
llvm_unreachable("Unhandled LookupKind in switch.");
}
ConstString GetName() const {
@@ -236,6 +238,8 @@ public:
builder.append(_module->getNameStr());
return builder.str();
}
llvm_unreachable("Unhandled LookupKind in switch.");
}
~DeclsLookupSource() {}
@@ -308,6 +312,8 @@ public:
case LookupKind::Extension:
return (_extension._decl != nullptr) && (_extension._module != nullptr);
}
llvm_unreachable("Unhandled LookupKind in switch.");
}
bool IsExtension() {