Skip to content

Commit 6c4273f

Browse files
hughbejrose-apple
authored andcommitted
Fix errors and warnings building libSwiftDriver on Windows using MSVC (#5951)
1 parent 1aa951d commit 6c4273f

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

include/swift/Driver/Driver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class OutputInfo {
114114
/// (If empty, this implies no SDK.)
115115
std::string SDKPath;
116116

117-
enum SanitizerKind SelectedSanitizer;
117+
SanitizerKind SelectedSanitizer;
118118
};
119119

120120
class Driver {

lib/Driver/CompilationRecord.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ inline static StringRef getName(TopLevelKey Key) {
4444
case TopLevelKey::BuildTime: return "build_time";
4545
case TopLevelKey::Inputs: return "inputs";
4646
}
47+
48+
// Work around MSVC warning: not all control paths return a value
49+
llvm_unreachable("All switch cases are covered");
4750
}
4851

4952
/// \returns The string identifier used to represent the given status in a
@@ -64,6 +67,9 @@ getIdentifierForInputInfoStatus(CompileJobAction::InputInfo::Status Status) {
6467
case CompileJobAction::InputInfo::NeedsNonCascadingBuild:
6568
return "!private";
6669
}
70+
71+
// Work around MSVC warning: not all control paths return a value
72+
llvm_unreachable("All switch cases are covered");
6773
}
6874

6975
/// \returns The status corresponding to the string identifier used in a

lib/Driver/ToolChain.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ using namespace swift;
3131
using namespace swift::driver;
3232
using namespace llvm::opt;
3333

34-
const char * const ToolChain::SWIFT_EXECUTABLE_NAME;
35-
3634
ToolChain::JobContext::JobContext(Compilation &C,
3735
ArrayRef<const Job *> Inputs,
3836
ArrayRef<const Action *> InputActions,
@@ -91,6 +89,9 @@ ToolChain::constructJob(const JobAction &JA,
9189
case Action::Input:
9290
llvm_unreachable("not a JobAction");
9391
}
92+
93+
// Work around MSVC warning: not all control paths return a value
94+
llvm_unreachable("All switch cases are covered");
9495
}();
9596

9697
// Special-case the Swift frontend.

lib/Driver/Types.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ bool types::isTextual(ID Id) {
9292
case types::TY_INVALID:
9393
llvm_unreachable("Invalid type ID.");
9494
}
95+
96+
// Work around MSVC warning: not all control paths return a value
97+
llvm_unreachable("All switch cases are covered");
9598
}
9699

97100
bool types::isAfterLLVM(ID Id) {
@@ -122,6 +125,9 @@ bool types::isAfterLLVM(ID Id) {
122125
case types::TY_INVALID:
123126
llvm_unreachable("Invalid type ID.");
124127
}
128+
129+
// Work around MSVC warning: not all control paths return a value
130+
llvm_unreachable("All switch cases are covered");
125131
}
126132

127133
bool types::isPartOfSwiftCompilation(ID Id) {
@@ -152,4 +158,7 @@ bool types::isPartOfSwiftCompilation(ID Id) {
152158
case types::TY_INVALID:
153159
llvm_unreachable("Invalid type ID.");
154160
}
161+
162+
// Work around MSVC warning: not all control paths return a value
163+
llvm_unreachable("All switch cases are covered");
155164
}

0 commit comments

Comments
 (0)