Skip to content

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

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 1 commit into from
Dec 10, 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
22 changes: 17 additions & 5 deletions lib/IDE/CodeCompletion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,8 @@ CodeCompletionResult *CodeCompletionResultBuilder::takeResult() {
CodeCompletionResult(*LiteralKind, SemanticContext, NumBytesToErase,
CCS, ExpectedTypeRelation);
}

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

void CodeCompletionResultBuilder::finishResult() {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -2195,6 +2199,8 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
// these parameters.
return true;
}

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

// Do not desugar AFT->getInput(), as we want to treat (_: (a,b)) distinctly
Expand Down Expand Up @@ -2368,6 +2374,8 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
case LookupKind::ImportFromModule:
return false;
}

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

void addMethodCall(const FuncDecl *FD, DeclVisibilityKind Reason) {
Expand Down Expand Up @@ -5075,7 +5083,7 @@ void CodeCompletionCallbacksImpl::doneParsing() {
if (isDynamicLookup(*ExprType))
Lookup.setIsDynamicLookup();

CodeCompletionTypeContextAnalyzer TypeAnalyzer(CurDeclContext, ParsedExpr);
::CodeCompletionTypeContextAnalyzer TypeAnalyzer(CurDeclContext, ParsedExpr);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

llvm::SmallVector<Type, 2> PossibleTypes;
if (TypeAnalyzer.Analyze(PossibleTypes)) {
Lookup.setExpectedTypes(PossibleTypes);
Expand All @@ -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)) {
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (!Result.second)
return; // already handled.

Expand Down Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion lib/IDE/CodeCompletionCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions lib/IDE/TypeReconstruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ class DeclsLookupSource {
case LookupKind::Crawler:
return nullptr;
}

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

ConstString GetName() const {
Expand All @@ -236,6 +238,8 @@ class DeclsLookupSource {
builder.append(_module->getNameStr());
return builder.str();
}

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

~DeclsLookupSource() {}
Expand Down Expand Up @@ -308,6 +312,8 @@ class DeclsLookupSource {
case LookupKind::Extension:
return (_extension._decl != nullptr) && (_extension._module != nullptr);
}

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

bool IsExtension() {
Expand Down