Skip to content

Commit a17573a

Browse files
authored
Merge pull request #27152 from save-buffer/fix_warnings
Fix warnings
2 parents b8fb2e5 + edc26bb commit a17573a

23 files changed

+51
-1
lines changed

include/swift/AST/PropertyWrappers.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ struct PropertyWrapperMutability {
109109
}
110110
return std::max(Getter, Setter);
111111
}
112+
llvm_unreachable("Unhandled Value in switch");
112113
}
113114

114115
bool operator==(PropertyWrapperMutability other) const {

include/swift/AST/Requirement.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ class Requirement {
167167
case RequirementKind::Layout:
168168
return lhs.getLayoutConstraint() == rhs.getLayoutConstraint();
169169
}
170+
llvm_unreachable("Unhandled RequirementKind in switch");
170171
}
171172
};
172173

include/swift/AST/ResilienceExpansion.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
5454
case ResilienceExpansion::Maximal:
5555
return os << "Maximal";
5656
}
57+
llvm_unreachable("Unhandled ResilienceExpansion in switch");
5758
}
5859

5960
} // namespace swift

include/swift/SIL/AbstractionPattern.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@ class AbstractionPattern {
402402
case Kind::Tuple:
403403
return false;
404404
}
405+
llvm_unreachable("Unhandled AbstractionPatternKind in switch");
405406
}
406407

407408
CanGenericSignature getGenericSignature() const {

lib/AST/ASTContext.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4477,6 +4477,7 @@ bool ASTContext::overrideGenericSignatureReqsSatisfied(
44774477
case OverrideGenericSignatureReqCheck::DerivedReqSatisfiedByBase:
44784478
return derivedSig->requirementsNotSatisfiedBy(sig).empty();
44794479
}
4480+
llvm_unreachable("Unhandled OverrideGenericSignatureReqCheck in switch");
44804481
}
44814482

44824483
SILLayout *SILLayout::get(ASTContext &C,

lib/AST/ASTScope.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,17 @@ Optional<bool> ASTScope::computeIsCascadingUse(
5353
return ASTScopeImpl::computeIsCascadingUse(history, initialIsCascadingUse);
5454
}
5555

56+
#if SWIFT_COMPILER_IS_MSVC
57+
#pragma warning(push)
58+
#pragma warning(disable : 4996)
59+
#endif
60+
5661
void ASTScope::dump() const { impl->dump(); }
62+
63+
#if SWIFT_COMPILER_IS_MSVC
64+
#pragma warning(pop)
65+
#endif
66+
5767
void ASTScope::print(llvm::raw_ostream &out) const { impl->print(out); }
5868
void ASTScope::dumpOneScopeMapLocation(std::pair<unsigned, unsigned> lineCol) {
5969
impl->dumpOneScopeMapLocation(lineCol);

lib/AST/ASTScopeCreation.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,6 +1178,7 @@ ConditionalClauseScope::expandAScopeThatCreatesANewInsertionPoint(
11781178
return {ccPatternUseScope,
11791179
"Succeeding code must be in scope of conditional variables"};
11801180
}
1181+
llvm_unreachable("Unhandled StmtConditionKind in switch");
11811182
}
11821183

11831184
AnnotatedInsertionPoint

lib/AST/Decl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7660,6 +7660,7 @@ ParseAbstractFunctionBodyRequest::getCachedResult() const {
76607660
case BodyKind::Unparsed:
76617661
return None;
76627662
}
7663+
llvm_unreachable("Unhandled BodyKing in switch");
76637664
}
76647665

76657666
void ParseAbstractFunctionBodyRequest::cacheResult(BraceStmt *value) const {

lib/AST/DeclContext.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,6 +1037,7 @@ SourceLoc swift::extractNearestSourceLoc(const DeclContext *dc) {
10371037
case DeclContextKind::SerializedLocal:
10381038
return extractNearestSourceLoc(dc->getParent());
10391039
}
1040+
llvm_unreachable("Unhandled DeclCopntextKindin switch");
10401041
}
10411042

10421043
#define DECL(Id, Parent) \

lib/AST/GenericSignature.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,4 +1091,5 @@ Requirement Requirement::getCanonical() const {
10911091
case RequirementKind::Layout:
10921092
return Requirement(getKind(), firstType, getLayoutConstraint());
10931093
}
1094+
llvm_unreachable("Unhandled RequirementKind in switch");
10941095
}

lib/Basic/FileSystem.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ std::error_code swift::moveFileIfDifferent(const llvm::Twine &source,
257257
// Files are different; overwrite the destination file.
258258
return fs::rename(source, destination);
259259
}
260+
llvm_unreachable("Unhandled FileDifference in switch");
260261
}
261262

262263
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>

lib/Basic/LangOptions.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ ArrayRef<StringRef> getSupportedConditionalCompilationValues(const PlatformCondi
8686
case PlatformConditionKind::TargetEnvironment:
8787
return SupportedConditionalCompilationTargetEnvironments;
8888
}
89+
llvm_unreachable("Unhandled PlatformConditionKind in switch");
8990
}
9091

9192
PlatformConditionKind suggestedPlatformConditionKind(PlatformConditionKind Kind, const StringRef &V,

lib/IDE/CodeCompletion.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2040,6 +2040,7 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
20402040
LookUpConformanceInModule(CurrModule));
20412041
}
20422042
}
2043+
llvm_unreachable("Unhandled DynamicLookupInfo Kind in switch");
20432044
}
20442045

20452046
Type getTypeOfMember(const ValueDecl *VD, Type ExprType) {

lib/Parse/ParseIfConfig.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ static StringRef getPlatformConditionName(PlatformConditionKind Kind) {
5151
case PlatformConditionKind::LABEL: return IDENTIFIER;
5252
#include "swift/AST/PlatformConditionKinds.def"
5353
}
54+
llvm_unreachable("Unhandled PlatformConditionKind in switch");
5455
}
5556

5657
/// Extract source text of the expression.

lib/Parse/ParseRequests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ BraceStmt *ParseAbstractFunctionBodyRequest::evaluate(
8686
return body;
8787
}
8888
}
89-
89+
llvm_unreachable("Unhandled BodyKind in switch");
9090
}
9191

9292

lib/Parse/Scope.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,13 @@ void ScopeInfo::addToScope(ValueDecl *D, Parser &TheParser,
145145
std::make_pair(CurScope->getDepth(), D));
146146
}
147147

148+
149+
// Disable the "for use only in debugger" warning.
150+
#if SWIFT_COMPILER_IS_MSVC
151+
#pragma warning(push)
152+
#pragma warning(disable : 4996)
153+
#endif
154+
148155
void ScopeInfo::dump() const {
149156
#ifndef NDEBUG
150157
// Dump out the current list of scopes.
@@ -167,3 +174,7 @@ void ScopeInfo::dump() const {
167174
llvm::dbgs() << "\n";
168175
#endif
169176
}
177+
178+
#if SWIFT_COMPILER_IS_MSVC
179+
#pragma warning(pop)
180+
#endif

lib/SIL/SILPrinter.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2993,6 +2993,12 @@ void SILCoverageMap::dump() const {
29932993
}
29942994

29952995
#ifndef NDEBUG
2996+
// Disable the "for use only in debugger" warning.
2997+
#if SWIFT_COMPILER_IS_MSVC
2998+
#pragma warning(push)
2999+
#pragma warning(disable : 4996)
3000+
#endif
3001+
29963002
void SILDebugScope::dump(SourceManager &SM, llvm::raw_ostream &OS,
29973003
unsigned Indent) const {
29983004
OS << "{\n";
@@ -3026,6 +3032,10 @@ void SILDebugScope::dump(SILModule &Mod) const {
30263032
dump(Mod.getASTContext().SourceMgr);
30273033
}
30283034

3035+
#if SWIFT_COMPILER_IS_MSVC
3036+
#pragma warning(pop)
3037+
#endif
3038+
30293039
#endif
30303040

30313041
void SILSpecializeAttr::print(llvm::raw_ostream &OS) const {

lib/Sema/CSDiagnostics.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,6 +1887,7 @@ getContextualNilDiagnostic(ContextualTypePurpose CTP) {
18871887
case CTP_SubscriptAssignSource:
18881888
return diag::cannot_convert_subscript_assign_nil;
18891889
}
1890+
llvm_unreachable("Unhandled ContextualTypePurpose in switch");
18901891
}
18911892

18921893
bool ContextualFailure::diagnoseConversionToNil() const {

lib/Sema/CSSimplify.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2129,6 +2129,7 @@ static ConstraintFix *fixPropertyWrapperFailure(
21292129
return UseWrappedValue::create(cs, decl, baseTy, toType.getValueOr(type),
21302130
locator);
21312131
}
2132+
llvm_unreachable("Unhandled Fix type in switch");
21322133
};
21332134

21342135
if (auto storageWrapper = cs.getStorageWrapperInformation(resolvedOverload)) {

lib/Sema/TypeCheckStorage.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1818,6 +1818,7 @@ SynthesizeAccessorRequest::evaluate(Evaluator &evaluator,
18181818
#include "swift/AST/AccessorKinds.def"
18191819
llvm_unreachable("not an opaque accessor");
18201820
}
1821+
llvm_unreachable("Unhandled AccessorKind in switch");
18211822
}
18221823

18231824
llvm::Expected<bool>

lib/Syntax/Trivia.cpp.gyb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ TriviaPiece TriviaPiece::fromText(TriviaKind kind, StringRef text) {
3636
% end
3737
% end
3838
}
39+
llvm_unreachable("Unhandled TriviaKind in switch");
3940
}
4041

4142
void TriviaPiece::dump(llvm::raw_ostream &OS, unsigned Indent) const {

tools/sil-passpipeline-dumper/SILPassPipelineDumper.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &os, PassPipelineKind Kind) {
4040
return os << #NAME;
4141
#include "swift/SILOptimizer/PassManager/PassPipeline.def"
4242
}
43+
llvm_unreachable("Unhandled PassPipelineKind in switch");
4344
}
4445
} // namespace llvm
4546

tools/swift-api-digester/ModuleAnalyzerNodes.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ StringRef SDKNodeType::getTypeRoleDescription() const {
363363
case SDKNodeKind::TypeWitness:
364364
return "type witness type";
365365
}
366+
llvm_unreachable("Unhandled SDKNodeKind in switch");
366367
}
367368

368369
SDKNode *SDKNodeRoot::getInstance(SDKContext &Ctx) {

0 commit comments

Comments
 (0)