Skip to content

Commit ef5952c

Browse files
Merge pull request #3872 from swiftwasm/maxd/main-merge
Resolve conflicts with upstream `main`
2 parents dc24d16 + d846e0c commit ef5952c

File tree

24 files changed

+931
-29
lines changed

24 files changed

+931
-29
lines changed

benchmark/single-source/ChaCha.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,6 @@ func checkResult(_ plaintext: [UInt8]) {
363363
}
364364

365365
@inline(never)
366-
@_assemblyVision
367366
public func run_ChaCha(_ n: Int) {
368367
let key = Array(repeating: UInt8(1), count: 32)
369368
let nonce = Array(repeating: UInt8(2), count: 12)

include/swift/AST/DiagnosticsParse.def

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ ERROR(lex_unprintable_ascii_character,none,
107107
"unprintable ASCII character found in source file", ())
108108
ERROR(lex_invalid_utf8,none,
109109
"invalid UTF-8 found in source file", ())
110+
111+
NOTE(lex_experimental_regex_strawperson,none,
112+
"'%0'", (StringRef))
113+
110114
ERROR(lex_single_quote_string,none,
111115
"single-quoted string literal found, use '\"'", ())
112116
ERROR(lex_invalid_curly_quote,none,

include/swift/Basic/LangOptions.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ namespace swift {
144144
/// PackageDescription version to compile for.
145145
version::Version PackageDescriptionVersion;
146146

147+
/// Enable experimental string processing
148+
bool EnableExperimentalRegex = false;
149+
147150
/// Disable API availability checking.
148151
bool DisableAvailabilityChecking = false;
149152

include/swift/Option/FrontendOptions.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,10 @@ def disable_deserialization_recovery :
469469
Flag<["-"], "disable-deserialization-recovery">,
470470
HelpText<"Don't attempt to recover from missing xrefs (etc) in swiftmodules">;
471471

472+
def enable_experimental_regex :
473+
Flag<["-"], "enable-experimental-regex">,
474+
HelpText<"Enable experimental string processing">;
475+
472476
def disable_availability_checking : Flag<["-"],
473477
"disable-availability-checking">,
474478
HelpText<"Disable checking for potentially unavailable APIs">;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#ifndef EXPERIMENTAL_REGEX_BRIDGING
2+
#define EXPERIMENTAL_REGEX_BRIDGING
3+
4+
#ifdef __cplusplus
5+
extern "C" {
6+
#endif
7+
8+
typedef const char *(* ParseRegexStrawperson)(const char *);
9+
10+
void Parser_registerParseRegexStrawperson(ParseRegexStrawperson fn);
11+
12+
#ifdef __cplusplus
13+
} // extern "C"
14+
#endif
15+
16+
#endif // EXPERIMENTAL_REGEX_BRIDGING
17+
18+
19+
//const char* experimental_regex_strawperson(const char *in);
20+

include/swift/Parse/Lexer.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,15 @@ class Lexer {
607607
bool lexUnknown(bool EmitDiagnosticsIfToken);
608608

609609
NulCharacterKind getNulCharacterKind(const char *Ptr) const;
610+
611+
/// Emit diagnostics for single-quote string and suggest replacement
612+
/// with double-quoted equivalent.
613+
///
614+
/// Or, if we're in strawperson mode, we will emit a custom
615+
/// error message instead, determined by the Swift library.
616+
void diagnoseSingleQuoteStringLiteral(const char *TokStart,
617+
const char *TokEnd);
618+
610619
};
611620

612621
/// A lexer that can lex trivia into its pieces

include/swift/Runtime/ThreadLocalStorage.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ static_assert(std::is_same<__swift_thread_key_t, DWORD>::value,
121121
# define SWIFT_THREAD_KEY_CREATE _stdlib_thread_key_create
122122
# define SWIFT_THREAD_GETSPECIFIC _stdlib_thread_getspecific
123123
# define SWIFT_THREAD_SETSPECIFIC _stdlib_thread_setspecific
124-
# else
124+
125+
# elif !defined(SWIFT_STDLIB_SINGLE_THREADED_RUNTIME)
125126
// Otherwise use the pthread API.
126127
# include <pthread.h>
127128
# define SWIFT_THREAD_KEY_CREATE pthread_key_create

include/swift/module.modulemap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@ module OptimizerBridging {
88
export *
99
}
1010

11+
module ExperimentalRegexBridging {
12+
header "Parse/ExperimentalRegexBridging.h"
13+
export *
14+
}

lib/Frontend/CompilerInvocation.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,10 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
471471
= A->getOption().matches(OPT_enable_deserialization_recovery);
472472
}
473473

474+
// Experimental string processing
475+
Opts.EnableExperimentalRegex |=
476+
Args.hasArg(OPT_enable_experimental_regex);
477+
474478
Opts.DisableAvailabilityChecking |=
475479
Args.hasArg(OPT_disable_availability_checking);
476480
Opts.CheckAPIAvailabilityOnly |=

lib/Parse/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ _swift_gyb_target_sources(swiftParse PRIVATE
3131
target_link_libraries(swiftParse PRIVATE
3232
swiftAST
3333
swiftSyntax
34-
swiftSyntaxParse)
34+
swiftSyntaxParse
35+
)
3536

3637
add_dependencies(swiftParse swift-parse-syntax-generated-headers)
3738

0 commit comments

Comments
 (0)