Skip to content

Commit dc40787

Browse files
committed
[SourceKit] Compilation fixes for SourceKit on rebranch
1 parent e00e069 commit dc40787

File tree

6 files changed

+16
-10
lines changed

6 files changed

+16
-10
lines changed

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: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ namespace llvm {
3535
template<unsigned InternalLen> class SmallString;
3636
template<typename T, unsigned N> class SmallVector;
3737
template<typename T> class SmallVectorImpl;
38-
template<typename T> class Optional;
3938

4039
template<typename T>
4140
struct SaveAndRestore;

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

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

1313
#include "SourceKit/Support/Concurrency.h"
1414
#include "SourceKit/Config/config.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: 8 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,10 +37,14 @@ 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

47+
4348
// Create table mapping all options defined in Options.td.
4449
static const llvm::opt::OptTable::Info InfoTable[] = {
4550
#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM, \
@@ -53,9 +58,9 @@ static const llvm::opt::OptTable::Info InfoTable[] = {
5358
};
5459

5560
// Create OptTable class for parsing actual command line arguments
56-
class TestOptTable : public llvm::opt::OptTable {
61+
class TestOptTable : public llvm::opt::GenericOptTable {
5762
public:
58-
TestOptTable() : OptTable(InfoTable, std::size(InfoTable)){}
63+
TestOptTable() : GenericOptTable(InfoTable){}
5964
};
6065

6166
} // end anonymous namespace

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

Lines changed: 5 additions & 6 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"
@@ -581,11 +582,9 @@ handleRequestGlobalConfiguration(const RequestDict &Req,
581582
auto dict = RB.getDictionary();
582583
583584
Optional<unsigned> CompletionMaxASTContextReuseCount =
584-
Req.getOptionalInt64(KeyCompletionMaxASTContextReuseCount)
585-
.transform([](int64_t v) -> unsigned { return v; });
585+
swift::transform(Req.getOptionalInt64(KeyCompletionMaxASTContextReuseCount), [](int64_t v) -> unsigned { return v; });
586586
Optional<unsigned> CompletionCheckDependencyInterval =
587-
Req.getOptionalInt64(KeyCompletionCheckDependencyInterval)
588-
.transform([](int64_t v) -> unsigned { return v; });
587+
swift::transform(Req.getOptionalInt64(KeyCompletionCheckDependencyInterval), [](int64_t v) -> unsigned { return v; });
589588
590589
GlobalConfig::Settings UpdatedConfig =
591590
Config->update(CompletionMaxASTContextReuseCount,
@@ -1674,9 +1673,9 @@ handleRequestCollectVariableType(const RequestDict &Req,
16741673
if (getCompilerArgumentsForRequestOrEmitError(Req, Args, Rec))
16751674
return;
16761675
1677-
Optional<unsigned> Offset = Req.getOptionalInt64(KeyOffset).transform(
1676+
Optional<unsigned> Offset = swift::transform(Req.getOptionalInt64(KeyOffset),
16781677
[](int64_t v) -> unsigned { return v; });
1679-
Optional<unsigned> Length = Req.getOptionalInt64(KeyLength).transform(
1678+
Optional<unsigned> Length = swift::transform(Req.getOptionalInt64(KeyLength),
16801679
[](int64_t v) -> unsigned { return v; });
16811680
int64_t FullyQualified = false;
16821681
Req.getInt64(KeyFullyQualified, FullyQualified, /*isOptional=*/true);

0 commit comments

Comments
 (0)