Skip to content

Commit 534d7e9

Browse files
authored
Merge pull request #8136 from hughbe/vs2017-warnings
2 parents 8ef9d0b + 7a704b2 commit 534d7e9

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

lib/IDE/TypeReconstruction.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ using namespace swift;
2929
// FIXME: replace with std::string and StringRef as appropriate to each case.
3030
typedef const std::string ConstString;
3131

32-
static std::string stringWithFormat(const std::string fmt_str, ...) {
33-
int final_n, n = ((int)fmt_str.size()) * 2;
32+
static std::string stringWithFormat(const char *fmt_str, ...) {
33+
int final_n, n = ((int)strlen(fmt_str)) * 2;
3434
std::string str;
3535
std::unique_ptr<char[]> formatted;
3636
va_list ap;
3737
while (1) {
3838
formatted.reset(new char[n]);
39-
strcpy(&formatted[0], fmt_str.c_str());
39+
strcpy(&formatted[0], fmt_str);
4040
va_start(ap, fmt_str);
41-
final_n = vsnprintf(&formatted[0], n, fmt_str.c_str(), ap);
41+
final_n = vsnprintf(&formatted[0], n, fmt_str, ap);
4242
va_end(ap);
4343
if (final_n < 0 || final_n >= n)
4444
n += abs(final_n - n + 1);

lib/Index/Index.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "swift/Basic/StringExtras.h"
2525
#include "llvm/ADT/APInt.h"
2626
#include "llvm/ADT/SmallVector.h"
27+
#include "llvm/Support/ErrorHandling.h"
2728
#include "llvm/Support/FileSystem.h"
2829

2930
using namespace swift;
@@ -570,6 +571,8 @@ bool IndexSwiftASTWalker::startEntity(Decl *D, IndexSymbol &Info) {
570571
EntitiesStack.push_back({D, Info.symInfo, Info.roles, {}});
571572
return true;
572573
}
574+
575+
llvm_unreachable("Unhandled IndexDataConsumer in switch.");
573576
}
574577

575578
bool IndexSwiftASTWalker::startEntityDecl(ValueDecl *D) {

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "llvm/ADT/ScopedHashTable.h"
3939
#include "llvm/ADT/SmallString.h"
4040
#include "llvm/Support/Compiler.h"
41+
#include "llvm/Support/ErrorHandling.h"
4142
#include "llvm/Support/SaveAndRestore.h"
4243

4344
#define DEBUG_TYPE "protocol-conformance-checking"
@@ -5482,6 +5483,8 @@ bool TypeChecker::useObjectiveCBridgeableConformancesOfArgs(
54825483
return anyUnsatisfied;
54835484
}
54845485
}
5486+
5487+
llvm_unreachable("Unhandled RequirementCheckResult in switch.");
54855488
}
54865489

54875490
void TypeChecker::useBridgedNSErrorConformances(DeclContext *dc, Type type) {

0 commit comments

Comments
 (0)