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

View File

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

View File

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