Skip to content

Commit 2383db8

Browse files
authored
Merge pull request #6028 from hughbe/ide-msvc
2 parents 496534b + d8fbaa0 commit 2383db8

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

lib/IDE/CodeCompletion.cpp

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,6 +1107,8 @@ CodeCompletionResult *CodeCompletionResultBuilder::takeResult() {
11071107
CodeCompletionResult(*LiteralKind, SemanticContext, NumBytesToErase,
11081108
CCS, ExpectedTypeRelation);
11091109
}
1110+
1111+
llvm_unreachable("Unhandled CodeCompletionResult in switch.");
11101112
}
11111113

11121114
void CodeCompletionResultBuilder::finishResult() {
@@ -1517,6 +1519,8 @@ protocolForLiteralKind(CodeCompletionLiteralKind kind) {
15171519
case CodeCompletionLiteralKind::Tuple:
15181520
llvm_unreachable("no such protocol kind");
15191521
}
1522+
1523+
llvm_unreachable("Unhandled CodeCompletionLiteralKind in switch.");
15201524
}
15211525

15221526
/// Whether funcType has a single argument (not including defaulted arguments)
@@ -2195,6 +2199,8 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
21952199
// these parameters.
21962200
return true;
21972201
}
2202+
2203+
llvm_unreachable("Unhandled DefaultArgumentKind in switch.");
21982204
};
21992205

22002206
// Do not desugar AFT->getInput(), as we want to treat (_: (a,b)) distinctly
@@ -2368,6 +2374,8 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
23682374
case LookupKind::ImportFromModule:
23692375
return false;
23702376
}
2377+
2378+
llvm_unreachable("Unhandled LookupKind in switch.");
23712379
}
23722380

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

5078-
CodeCompletionTypeContextAnalyzer TypeAnalyzer(CurDeclContext, ParsedExpr);
5086+
::CodeCompletionTypeContextAnalyzer TypeAnalyzer(CurDeclContext, ParsedExpr);
50795087
llvm::SmallVector<Type, 2> PossibleTypes;
50805088
if (TypeAnalyzer.Analyze(PossibleTypes)) {
50815089
Lookup.setExpectedTypes(PossibleTypes);
@@ -5089,7 +5097,7 @@ void CodeCompletionCallbacksImpl::doneParsing() {
50895097
break;
50905098

50915099
case CompletionKind::PostfixExprBeginning: {
5092-
CodeCompletionTypeContextAnalyzer Analyzer(CurDeclContext,
5100+
::CodeCompletionTypeContextAnalyzer Analyzer(CurDeclContext,
50935101
CodeCompleteTokenExpr);
50945102
llvm::SmallVector<Type, 1> Types;
50955103
if (Analyzer.Analyze(Types)) {
@@ -5111,7 +5119,7 @@ void CodeCompletionCallbacksImpl::doneParsing() {
51115119
case CompletionKind::PostfixExprParen: {
51125120
Lookup.setHaveLParen(true);
51135121

5114-
CodeCompletionTypeContextAnalyzer TypeAnalyzer(CurDeclContext,
5122+
::CodeCompletionTypeContextAnalyzer TypeAnalyzer(CurDeclContext,
51155123
CodeCompleteTokenExpr);
51165124
SmallVector<Type, 2> PossibleTypes;
51175125
SmallVector<StringRef, 2> PossibleNames;
@@ -5332,8 +5340,10 @@ void CodeCompletionCallbacksImpl::doneParsing() {
53325340
AccessPath, Request.NeedLeadingDot,
53335341
SF.hasTestableImport(TheModule),
53345342
Ctx.LangOpts.CodeCompleteInitsInPostfixExpr};
5335-
std::pair<decltype(ImportsSeen)::iterator, bool>
5336-
Result = ImportsSeen.insert(K);
5343+
5344+
using PairType = llvm::DenseSet<swift::ide::CodeCompletionCache::Key,
5345+
llvm::DenseMapInfo<CodeCompletionCache::Key>>::iterator;
5346+
std::pair<PairType, bool> Result = ImportsSeen.insert(K);
53375347
if (!Result.second)
53385348
return; // already handled.
53395349

@@ -5485,6 +5495,8 @@ void swift::ide::copyCodeCompletionResults(CodeCompletionResultSink &targetSink,
54855495
case CodeCompletionDeclKind::GlobalVar:
54865496
return false;
54875497
}
5498+
5499+
llvm_unreachable("Unhandled CodeCompletionDeclKind in switch.");
54885500
});
54895501
} else {
54905502
targetSink.Results.insert(targetSink.Results.end(),

lib/IDE/CodeCompletionCache.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ static void writeCachedModule(llvm::raw_ostream &out,
358358
if (R->getKind() == CodeCompletionResult::Declaration)
359359
LE.write(static_cast<uint8_t>(R->getAssociatedDeclKind()));
360360
else
361-
LE.write(static_cast<uint8_t>(~0u));
361+
LE.write(~static_cast<uint8_t>(0u));
362362
if (R->isOperator())
363363
LE.write(static_cast<uint8_t>(R->getOperatorKind()));
364364
else

lib/IDE/TypeReconstruction.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ class DeclsLookupSource {
218218
case LookupKind::Crawler:
219219
return nullptr;
220220
}
221+
222+
llvm_unreachable("Unhandled LookupKind in switch.");
221223
}
222224

223225
ConstString GetName() const {
@@ -238,6 +240,8 @@ class DeclsLookupSource {
238240
builder.append(_module->getNameStr());
239241
return builder.str();
240242
}
243+
244+
llvm_unreachable("Unhandled LookupKind in switch.");
241245
}
242246

243247
~DeclsLookupSource() {}
@@ -310,6 +314,8 @@ class DeclsLookupSource {
310314
case LookupKind::Extension:
311315
return (_extension._decl != nullptr) && (_extension._module != nullptr);
312316
}
317+
318+
llvm_unreachable("Unhandled LookupKind in switch.");
313319
}
314320

315321
bool IsExtension() {

0 commit comments

Comments
 (0)