Skip to content

Fix warnings #27152

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 9 commits into from
Sep 13, 2019
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
1 change: 1 addition & 0 deletions include/swift/AST/PropertyWrappers.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ struct PropertyWrapperMutability {
}
return std::max(Getter, Setter);
}
llvm_unreachable("Unhandled Value in switch");
}

bool operator==(PropertyWrapperMutability other) const {
Expand Down
1 change: 1 addition & 0 deletions include/swift/AST/Requirement.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ class Requirement {
case RequirementKind::Layout:
return lhs.getLayoutConstraint() == rhs.getLayoutConstraint();
}
llvm_unreachable("Unhandled RequirementKind in switch");
}
};

Expand Down
1 change: 1 addition & 0 deletions include/swift/AST/ResilienceExpansion.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
case ResilienceExpansion::Maximal:
return os << "Maximal";
}
llvm_unreachable("Unhandled ResilienceExpansion in switch");
}

} // namespace swift
Expand Down
1 change: 1 addition & 0 deletions include/swift/SIL/AbstractionPattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ class AbstractionPattern {
case Kind::Tuple:
return false;
}
llvm_unreachable("Unhandled AbstractionPatternKind in switch");
}

CanGenericSignature getGenericSignature() const {
Expand Down
1 change: 1 addition & 0 deletions lib/AST/ASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4477,6 +4477,7 @@ bool ASTContext::overrideGenericSignatureReqsSatisfied(
case OverrideGenericSignatureReqCheck::DerivedReqSatisfiedByBase:
return derivedSig->requirementsNotSatisfiedBy(sig).empty();
}
llvm_unreachable("Unhandled OverrideGenericSignatureReqCheck in switch");
}

SILLayout *SILLayout::get(ASTContext &C,
Expand Down
10 changes: 10 additions & 0 deletions lib/AST/ASTScope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,17 @@ Optional<bool> ASTScope::computeIsCascadingUse(
return ASTScopeImpl::computeIsCascadingUse(history, initialIsCascadingUse);
}

#if SWIFT_COMPILER_IS_MSVC
#pragma warning(push)
#pragma warning(disable : 4996)
#endif

void ASTScope::dump() const { impl->dump(); }

#if SWIFT_COMPILER_IS_MSVC
#pragma warning(pop)
#endif

void ASTScope::print(llvm::raw_ostream &out) const { impl->print(out); }
void ASTScope::dumpOneScopeMapLocation(std::pair<unsigned, unsigned> lineCol) {
impl->dumpOneScopeMapLocation(lineCol);
Expand Down
1 change: 1 addition & 0 deletions lib/AST/ASTScopeCreation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1178,6 +1178,7 @@ ConditionalClauseScope::expandAScopeThatCreatesANewInsertionPoint(
return {ccPatternUseScope,
"Succeeding code must be in scope of conditional variables"};
}
llvm_unreachable("Unhandled StmtConditionKind in switch");
}

AnnotatedInsertionPoint
Expand Down
1 change: 1 addition & 0 deletions lib/AST/Decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7660,6 +7660,7 @@ ParseAbstractFunctionBodyRequest::getCachedResult() const {
case BodyKind::Unparsed:
return None;
}
llvm_unreachable("Unhandled BodyKing in switch");
}

void ParseAbstractFunctionBodyRequest::cacheResult(BraceStmt *value) const {
Expand Down
1 change: 1 addition & 0 deletions lib/AST/DeclContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,7 @@ SourceLoc swift::extractNearestSourceLoc(const DeclContext *dc) {
case DeclContextKind::SerializedLocal:
return extractNearestSourceLoc(dc->getParent());
}
llvm_unreachable("Unhandled DeclCopntextKindin switch");
}

#define DECL(Id, Parent) \
Expand Down
1 change: 1 addition & 0 deletions lib/AST/GenericSignature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1091,4 +1091,5 @@ Requirement Requirement::getCanonical() const {
case RequirementKind::Layout:
return Requirement(getKind(), firstType, getLayoutConstraint());
}
llvm_unreachable("Unhandled RequirementKind in switch");
}
1 change: 1 addition & 0 deletions lib/Basic/FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ std::error_code swift::moveFileIfDifferent(const llvm::Twine &source,
// Files are different; overwrite the destination file.
return fs::rename(source, destination);
}
llvm_unreachable("Unhandled FileDifference in switch");
}

llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
Expand Down
1 change: 1 addition & 0 deletions lib/Basic/LangOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ ArrayRef<StringRef> getSupportedConditionalCompilationValues(const PlatformCondi
case PlatformConditionKind::TargetEnvironment:
return SupportedConditionalCompilationTargetEnvironments;
}
llvm_unreachable("Unhandled PlatformConditionKind in switch");
}

PlatformConditionKind suggestedPlatformConditionKind(PlatformConditionKind Kind, const StringRef &V,
Expand Down
1 change: 1 addition & 0 deletions lib/IDE/CodeCompletion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2040,6 +2040,7 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
LookUpConformanceInModule(CurrModule));
}
}
llvm_unreachable("Unhandled DynamicLookupInfo Kind in switch");
}

Type getTypeOfMember(const ValueDecl *VD, Type ExprType) {
Expand Down
1 change: 1 addition & 0 deletions lib/Parse/ParseIfConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ static StringRef getPlatformConditionName(PlatformConditionKind Kind) {
case PlatformConditionKind::LABEL: return IDENTIFIER;
#include "swift/AST/PlatformConditionKinds.def"
}
llvm_unreachable("Unhandled PlatformConditionKind in switch");
}

/// Extract source text of the expression.
Expand Down
2 changes: 1 addition & 1 deletion lib/Parse/ParseRequests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ BraceStmt *ParseAbstractFunctionBodyRequest::evaluate(
return body;
}
}

llvm_unreachable("Unhandled BodyKind in switch");
}


Expand Down
11 changes: 11 additions & 0 deletions lib/Parse/Scope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ void ScopeInfo::addToScope(ValueDecl *D, Parser &TheParser,
std::make_pair(CurScope->getDepth(), D));
}


// Disable the "for use only in debugger" warning.
#if SWIFT_COMPILER_IS_MSVC
#pragma warning(push)
#pragma warning(disable : 4996)
#endif
Copy link
Member

Choose a reason for hiding this comment

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

I can't believe I never thought of this. This is a great idea!


void ScopeInfo::dump() const {
#ifndef NDEBUG
// Dump out the current list of scopes.
Expand All @@ -167,3 +174,7 @@ void ScopeInfo::dump() const {
llvm::dbgs() << "\n";
#endif
}

#if SWIFT_COMPILER_IS_MSVC
#pragma warning(pop)
#endif
10 changes: 10 additions & 0 deletions lib/SIL/SILPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2993,6 +2993,12 @@ void SILCoverageMap::dump() const {
}

#ifndef NDEBUG
// Disable the "for use only in debugger" warning.
#if SWIFT_COMPILER_IS_MSVC
#pragma warning(push)
#pragma warning(disable : 4996)
#endif

void SILDebugScope::dump(SourceManager &SM, llvm::raw_ostream &OS,
unsigned Indent) const {
OS << "{\n";
Expand Down Expand Up @@ -3026,6 +3032,10 @@ void SILDebugScope::dump(SILModule &Mod) const {
dump(Mod.getASTContext().SourceMgr);
}

#if SWIFT_COMPILER_IS_MSVC
#pragma warning(pop)
#endif

#endif

void SILSpecializeAttr::print(llvm::raw_ostream &OS) const {
Expand Down
1 change: 1 addition & 0 deletions lib/Sema/CSDiagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1887,6 +1887,7 @@ getContextualNilDiagnostic(ContextualTypePurpose CTP) {
case CTP_SubscriptAssignSource:
return diag::cannot_convert_subscript_assign_nil;
}
llvm_unreachable("Unhandled ContextualTypePurpose in switch");
}

bool ContextualFailure::diagnoseConversionToNil() const {
Expand Down
1 change: 1 addition & 0 deletions lib/Sema/CSSimplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2129,6 +2129,7 @@ static ConstraintFix *fixPropertyWrapperFailure(
return UseWrappedValue::create(cs, decl, baseTy, toType.getValueOr(type),
locator);
}
llvm_unreachable("Unhandled Fix type in switch");
};

if (auto storageWrapper = cs.getStorageWrapperInformation(resolvedOverload)) {
Expand Down
1 change: 1 addition & 0 deletions lib/Sema/TypeCheckStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1818,6 +1818,7 @@ SynthesizeAccessorRequest::evaluate(Evaluator &evaluator,
#include "swift/AST/AccessorKinds.def"
llvm_unreachable("not an opaque accessor");
}
llvm_unreachable("Unhandled AccessorKind in switch");
}

llvm::Expected<bool>
Expand Down
1 change: 1 addition & 0 deletions lib/Syntax/Trivia.cpp.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ TriviaPiece TriviaPiece::fromText(TriviaKind kind, StringRef text) {
% end
% end
}
llvm_unreachable("Unhandled TriviaKind in switch");
}

void TriviaPiece::dump(llvm::raw_ostream &OS, unsigned Indent) const {
Expand Down
1 change: 1 addition & 0 deletions tools/sil-passpipeline-dumper/SILPassPipelineDumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &os, PassPipelineKind Kind) {
return os << #NAME;
#include "swift/SILOptimizer/PassManager/PassPipeline.def"
}
llvm_unreachable("Unhandled PassPipelineKind in switch");
}
} // namespace llvm

Expand Down
1 change: 1 addition & 0 deletions tools/swift-api-digester/ModuleAnalyzerNodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ StringRef SDKNodeType::getTypeRoleDescription() const {
case SDKNodeKind::TypeWitness:
return "type witness type";
}
llvm_unreachable("Unhandled SDKNodeKind in switch");
}

SDKNode *SDKNodeRoot::getInstance(SDKContext &Ctx) {
Expand Down