Skip to content

Commit 76ff2c1

Browse files
authored
Merge pull request #67589 from bnbarham/rebranch-fixes
[rebranch] Assortment of rebranch fixes
2 parents 6610561 + bfd26d0 commit 76ff2c1

File tree

9 files changed

+30
-18
lines changed

9 files changed

+30
-18
lines changed

include/swift/ABI/ObjectFile.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
#ifndef SWIFT_ABI_OBJECTFILE_H
88
#define SWIFT_ABI_OBJECTFILE_H
99

10-
#include "llvm/Support/ErrorHandling.h"
10+
#include "llvm/ADT/Optional.h"
1111
#include "llvm/ADT/StringRef.h"
12+
#include "llvm/Support/ErrorHandling.h"
1213

1314
namespace swift {
1415

lib/IDETool/DependencyChecking.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "swift/Basic/LLVM.h"
14+
#include "llvm/ADT/Optional.h"
1415
#include "llvm/ADT/StringMap.h"
1516
#include "llvm/Support/Chrono.h"
1617
#include "llvm/Support/VirtualFileSystem.h"

tools/SourceKit/include/SourceKit/Core/Context.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "SourceKit/Core/LLVM.h"
1717
#include "SourceKit/Support/CancellationToken.h"
1818
#include "SourceKit/Support/Concurrency.h"
19+
#include "llvm/ADT/Optional.h"
1920
#include "llvm/ADT/STLExtras.h"
2021
#include "llvm/ADT/StringRef.h"
2122
#include "llvm/Support/Mutex.h"

tools/SourceKit/include/SourceKit/Core/LLVM.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ namespace llvm {
3434
template<typename T> class ArrayRef;
3535
template<unsigned InternalLen> class SmallString;
3636
template<typename T, unsigned N> class SmallVector;
37-
template<typename T> class SmallVectorImpl;
38-
template<typename T> class Optional;
37+
template <typename T>
38+
class SmallVectorImpl;
3939

4040
template<typename T>
4141
struct SaveAndRestore;

tools/SourceKit/lib/Support/Concurrency-libdispatch.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#include "SourceKit/Support/Concurrency.h"
1413
#include "SourceKit/Config/config.h"
14+
#include "SourceKit/Support/Concurrency.h"
15+
#include "llvm/ADT/Optional.h"
1516
#include "llvm/ADT/SmallString.h"
1617
#include "llvm/Support/ErrorHandling.h"
1718
#include "llvm/Support/thread.h"

tools/SourceKit/tools/sourcekitd-test/TestOptions.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "TestOptions.h"
1414
#include "llvm/ADT/STLExtras.h"
15+
#include "llvm/ADT/StringRef.h"
1516
#include "llvm/ADT/StringSwitch.h"
1617
#include "llvm/Option/Arg.h"
1718
#include "llvm/Option/ArgList.h"
@@ -36,7 +37,10 @@ enum Opt {
3637
};
3738

3839
// Create prefix string literals used in Options.td.
39-
#define PREFIX(NAME, VALUE) const char *const NAME[] = VALUE;
40+
#define PREFIX(NAME, VALUE) \
41+
constexpr llvm::StringLiteral NAME##_init[] = VALUE; \
42+
constexpr llvm::ArrayRef<llvm::StringLiteral> NAME( \
43+
NAME##_init, std::size(NAME##_init) - 1);
4044
#include "Options.inc"
4145
#undef PREFIX
4246

@@ -53,9 +57,9 @@ static const llvm::opt::OptTable::Info InfoTable[] = {
5357
};
5458

5559
// Create OptTable class for parsing actual command line arguments
56-
class TestOptTable : public llvm::opt::OptTable {
60+
class TestOptTable : public llvm::opt::GenericOptTable {
5761
public:
58-
TestOptTable() : OptTable(InfoTable, std::size(InfoTable)){}
62+
TestOptTable() : GenericOptTable(InfoTable) {}
5963
};
6064

6165
} // end anonymous namespace

tools/SourceKit/tools/sourcekitd/lib/Service/Requests.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
#include "llvm/ADT/ArrayRef.h"
3939
#include "llvm/ADT/IntrusiveRefCntPtr.h"
40+
#include "llvm/ADT/Optional.h"
4041
#include "llvm/ADT/STLExtras.h"
4142
#include "llvm/ADT/SmallString.h"
4243
#include "llvm/ADT/StringRef.h"
@@ -580,12 +581,12 @@ handleRequestGlobalConfiguration(const RequestDict &Req,
580581
ResponseBuilder RB;
581582
auto dict = RB.getDictionary();
582583
583-
Optional<unsigned> CompletionMaxASTContextReuseCount =
584-
Req.getOptionalInt64(KeyCompletionMaxASTContextReuseCount)
585-
.transform([](int64_t v) -> unsigned { return v; });
586-
Optional<unsigned> CompletionCheckDependencyInterval =
587-
Req.getOptionalInt64(KeyCompletionCheckDependencyInterval)
588-
.transform([](int64_t v) -> unsigned { return v; });
584+
Optional<unsigned> CompletionMaxASTContextReuseCount = swift::transform(
585+
Req.getOptionalInt64(KeyCompletionMaxASTContextReuseCount),
586+
[](int64_t v) -> unsigned { return v; });
587+
Optional<unsigned> CompletionCheckDependencyInterval = swift::transform(
588+
Req.getOptionalInt64(KeyCompletionCheckDependencyInterval),
589+
[](int64_t v) -> unsigned { return v; });
589590
590591
GlobalConfig::Settings UpdatedConfig =
591592
Config->update(CompletionMaxASTContextReuseCount,
@@ -1674,10 +1675,12 @@ handleRequestCollectVariableType(const RequestDict &Req,
16741675
if (getCompilerArgumentsForRequestOrEmitError(Req, Args, Rec))
16751676
return;
16761677
1677-
Optional<unsigned> Offset = Req.getOptionalInt64(KeyOffset).transform(
1678-
[](int64_t v) -> unsigned { return v; });
1679-
Optional<unsigned> Length = Req.getOptionalInt64(KeyLength).transform(
1680-
[](int64_t v) -> unsigned { return v; });
1678+
Optional<unsigned> Offset =
1679+
swift::transform(Req.getOptionalInt64(KeyOffset),
1680+
[](int64_t v) -> unsigned { return v; });
1681+
Optional<unsigned> Length =
1682+
swift::transform(Req.getOptionalInt64(KeyLength),
1683+
[](int64_t v) -> unsigned { return v; });
16811684
int64_t FullyQualified = false;
16821685
Req.getInt64(KeyFullyQualified, FullyQualified, /*isOptional=*/true);
16831686
return Lang.collectVariableTypes(

tools/libMockPlugin/MockPlugin.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "swift-c/MockPlugin/MockPlugin.h"
14+
#include "llvm/ADT/StringExtras.h"
1415
#include "llvm/Support/Endian.h"
1516
#include "llvm/Support/JSON.h"
1617

tools/libSwiftScan/libSwiftScan.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ static void addFrontendFlagOption(llvm::opt::OptTable &table,
560560
std::vector<std::string> &frontendOptions) {
561561
if (table.getOption(id).hasFlag(swift::options::FrontendOption)) {
562562
auto name = table.getOptionName(id);
563-
if (strlen(name) > 0) {
563+
if (!name.empty()) {
564564
frontendOptions.push_back(std::string(name));
565565
}
566566
}

0 commit comments

Comments
 (0)