Skip to content

Commit bdf5207

Browse files
authored
Merge pull request #4017 from swiftwasm/main
[pull] swiftwasm from main
2 parents 0556ae6 + eb07d54 commit bdf5207

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1974
-1237
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,9 @@ namespace swift {
283283
/// Whether to dump debug info for request evaluator cycles.
284284
bool DebugDumpCycles = false;
285285

286+
/// Disable SIL substituted function types.
287+
bool DisableSubstSILFunctionTypes = false;
288+
286289
/// Whether to diagnose an ephemeral to non-ephemeral conversion as an
287290
/// error.
288291
bool DiagnoseInvalidEphemeralnessAsError = false;

include/swift/IDE/CodeCompletion.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ class CodeCompletionStringChunk {
174174
/// Argument type tag for annotated results.
175175
CallArgumentTypeBegin,
176176

177+
/// Added if the argument has a default value.
178+
CallArgumentDefaultBegin,
179+
177180
/// System type name.
178181
TypeIdSystem,
179182

@@ -252,6 +255,7 @@ class CodeCompletionStringChunk {
252255
Kind == ChunkKind::GenericParameterBegin ||
253256
Kind == ChunkKind::OptionalBegin ||
254257
Kind == ChunkKind::CallArgumentTypeBegin ||
258+
Kind == ChunkKind::CallArgumentDefaultBegin ||
255259
Kind == ChunkKind::TypeAnnotationBegin ||
256260
Kind == ChunkKind::ParameterDeclBegin ||
257261
Kind == ChunkKind::ParameterDeclTypeBegin ||
@@ -958,6 +962,9 @@ struct CodeCompletionResultSink {
958962
/// Whether to perform "call pettern heuristics".
959963
bool enableCallPatternHeuristics = false;
960964

965+
/// Whether to include an item without any default arguments.
966+
bool addCallWithNoDefaultArgs = true;
967+
961968
std::vector<CodeCompletionResult *> Results;
962969

963970
/// A single-element cache for module names stored in Allocator, keyed by a
@@ -1050,6 +1057,13 @@ class CodeCompletionContext {
10501057
return CurrentResults.enableCallPatternHeuristics;
10511058
}
10521059

1060+
void setAddCallWithNoDefaultArgs(bool flag) {
1061+
CurrentResults.addCallWithNoDefaultArgs = flag;
1062+
}
1063+
bool addCallWithNoDefaultArgs() const {
1064+
return CurrentResults.addCallWithNoDefaultArgs;
1065+
}
1066+
10531067
/// Allocate a string owned by the code completion context.
10541068
StringRef copyString(StringRef Str);
10551069

include/swift/IDE/CodeCompletionCache.h

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
#ifndef SWIFT_IDE_CODE_COMPLETIONCACHE_H
1414
#define SWIFT_IDE_CODE_COMPLETIONCACHE_H
1515

16-
#include "swift/IDE/CodeCompletion.h"
1716
#include "swift/Basic/ThreadSafeRefCounted.h"
17+
#include "swift/IDE/CodeCompletion.h"
18+
#include "llvm/ADT/Hashing.h"
1819
#include "llvm/ADT/IntrusiveRefCntPtr.h"
1920
#include "llvm/Support/Chrono.h"
2021
#include <system_error>
@@ -43,17 +44,19 @@ class CodeCompletionCache {
4344
bool ForTestableLookup;
4445
bool ForPrivateImportLookup;
4546
bool AddInitsInToplevel;
47+
bool AddCallWithNoDefaultArgs;
4648
bool Annotated;
4749

4850
friend bool operator==(const Key &LHS, const Key &RHS) {
4951
return LHS.ModuleFilename == RHS.ModuleFilename &&
50-
LHS.ModuleName == RHS.ModuleName &&
51-
LHS.AccessPath == RHS.AccessPath &&
52-
LHS.ResultsHaveLeadingDot == RHS.ResultsHaveLeadingDot &&
53-
LHS.ForTestableLookup == RHS.ForTestableLookup &&
54-
LHS.ForPrivateImportLookup == RHS.ForPrivateImportLookup &&
55-
LHS.AddInitsInToplevel == RHS.AddInitsInToplevel &&
56-
LHS.Annotated == RHS.Annotated;
52+
LHS.ModuleName == RHS.ModuleName &&
53+
LHS.AccessPath == RHS.AccessPath &&
54+
LHS.ResultsHaveLeadingDot == RHS.ResultsHaveLeadingDot &&
55+
LHS.ForTestableLookup == RHS.ForTestableLookup &&
56+
LHS.ForPrivateImportLookup == RHS.ForPrivateImportLookup &&
57+
LHS.AddInitsInToplevel == RHS.AddInitsInToplevel &&
58+
LHS.AddCallWithNoDefaultArgs == RHS.AddCallWithNoDefaultArgs &&
59+
LHS.Annotated == RHS.Annotated;
5760
}
5861
};
5962

@@ -110,23 +113,18 @@ template<>
110113
struct DenseMapInfo<swift::ide::CodeCompletionCache::Key> {
111114
using KeyTy = swift::ide::CodeCompletionCache::Key;
112115
static inline KeyTy getEmptyKey() {
113-
return KeyTy{"", "", {}, false, false, false, false, false};
116+
return KeyTy{"", "", {}, false, false, false, false, false, false};
114117
}
115118
static inline KeyTy getTombstoneKey() {
116-
return KeyTy{"", "", {}, true, false, false, false, false};
119+
return KeyTy{"", "", {}, true, false, false, false, false, false};
117120
}
118121
static unsigned getHashValue(const KeyTy &Val) {
119-
size_t H = 0;
120-
H ^= std::hash<std::string>()(Val.ModuleFilename);
121-
H ^= std::hash<std::string>()(Val.ModuleName);
122-
for (auto Piece : Val.AccessPath)
123-
H ^= std::hash<std::string>()(Piece);
124-
H ^= std::hash<bool>()(Val.ResultsHaveLeadingDot);
125-
H ^= std::hash<bool>()(Val.ForTestableLookup);
126-
H ^= std::hash<bool>()(Val.ForPrivateImportLookup);
127-
H ^= std::hash<bool>()(Val.AddInitsInToplevel);
128-
H ^= std::hash<bool>()(Val.Annotated);
129-
return static_cast<unsigned>(H);
122+
return llvm::hash_combine(
123+
Val.ModuleFilename, Val.ModuleName,
124+
llvm::hash_combine_range(Val.AccessPath.begin(), Val.AccessPath.end()),
125+
Val.ResultsHaveLeadingDot, Val.ForTestableLookup,
126+
Val.ForPrivateImportLookup, Val.AddInitsInToplevel,
127+
Val.AddCallWithNoDefaultArgs, Val.Annotated);
130128
}
131129
static bool isEqual(const KeyTy &LHS, const KeyTy &RHS) {
132130
return LHS == RHS;

include/swift/Option/FrontendOptions.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,10 @@ def enable_experimental_static_assert :
476476
Flag<["-"], "enable-experimental-static-assert">,
477477
HelpText<"Enable experimental #assert">;
478478

479+
def disable_subst_sil_function_types :
480+
Flag<["-"], "disable-subst-sil-function-types">,
481+
HelpText<"Disable substituted function types for SIL type lowering of function values">;
482+
479483
def enable_experimental_named_opaque_types :
480484
Flag<["-"], "enable-experimental-named-opaque-types">,
481485
HelpText<"Enable experimental support for named opaque result types">;

0 commit comments

Comments
 (0)