mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[cxx-interop] [nfc] Remove swift namespace from SwiftShims in C++ mode. (#32715)
Most SwiftShims were put in the swift namespace in C++ mode which broke certain things when importing them in a swift file in C++ mode. This was OK when they were only imported as part of the swift runtime but, now they are used in C++ mode both in the swift runtime and when C++ interop is enabled. This broke when C++ interop was enabled because the `Swift` module contains references to symbols in the SwiftShims headers which are built without C++ interop enabled (no "swift" namespace). But, when C++ interop is enabled, the SwiftShims headers would put everything in the swift namespace meaning the symbols couldn't be found in the global namespace. Then, the compiler would error when trying to deserialize the Swift module.
This commit is contained in:
@@ -33,7 +33,7 @@ typedef enum UCharNameChoice {} UCharNameChoice;
|
||||
typedef uint16_t UChar;
|
||||
typedef int32_t UChar32;
|
||||
typedef int8_t UBool;
|
||||
typedef swift::__swift_stdlib_UProperty UProperty;
|
||||
typedef __swift_stdlib_UProperty UProperty;
|
||||
|
||||
#define U_MAX_VERSION_LENGTH 4
|
||||
typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
|
||||
@@ -103,7 +103,7 @@ double u_getNumericValue(UChar32);
|
||||
/// 'DestinationCapacity' this function must be called again with a buffer of
|
||||
/// the required length to get an uppercase version of the string.
|
||||
int32_t
|
||||
swift::_swift_stdlib_unicode_strToUpper(uint16_t *Destination,
|
||||
_swift_stdlib_unicode_strToUpper(uint16_t *Destination,
|
||||
int32_t DestinationCapacity,
|
||||
const uint16_t *Source,
|
||||
int32_t SourceLength) {
|
||||
@@ -124,7 +124,7 @@ swift::_swift_stdlib_unicode_strToUpper(uint16_t *Destination,
|
||||
/// 'DestinationCapacity' this function must be called again with a buffer of
|
||||
/// the required length to get a lowercase version of the string.
|
||||
int32_t
|
||||
swift::_swift_stdlib_unicode_strToLower(uint16_t *Destination,
|
||||
_swift_stdlib_unicode_strToLower(uint16_t *Destination,
|
||||
int32_t DestinationCapacity,
|
||||
const uint16_t *Source,
|
||||
int32_t SourceLength) {
|
||||
@@ -150,49 +150,49 @@ template <typename T, typename U> const T *ptr_cast(const U *p) {
|
||||
}
|
||||
}
|
||||
|
||||
void swift::__swift_stdlib_ubrk_close(
|
||||
swift::__swift_stdlib_UBreakIterator *bi) {
|
||||
void __swift_stdlib_ubrk_close(
|
||||
__swift_stdlib_UBreakIterator *bi) {
|
||||
ubrk_close(ptr_cast<UBreakIterator>(bi));
|
||||
}
|
||||
|
||||
swift::__swift_stdlib_UBreakIterator *swift::__swift_stdlib_ubrk_open(
|
||||
swift::__swift_stdlib_UBreakIteratorType type, const char *locale,
|
||||
__swift_stdlib_UBreakIterator *__swift_stdlib_ubrk_open(
|
||||
__swift_stdlib_UBreakIteratorType type, const char *locale,
|
||||
const __swift_stdlib_UChar *text, int32_t textLength,
|
||||
__swift_stdlib_UErrorCode *status) {
|
||||
return ptr_cast<swift::__swift_stdlib_UBreakIterator>(
|
||||
return ptr_cast<__swift_stdlib_UBreakIterator>(
|
||||
ubrk_open(static_cast<UBreakIteratorType>(type), locale,
|
||||
reinterpret_cast<const UChar *>(text), textLength,
|
||||
ptr_cast<UErrorCode>(status)));
|
||||
}
|
||||
|
||||
int32_t
|
||||
swift::__swift_stdlib_ubrk_preceding(swift::__swift_stdlib_UBreakIterator *bi,
|
||||
__swift_stdlib_ubrk_preceding(__swift_stdlib_UBreakIterator *bi,
|
||||
int32_t offset) {
|
||||
return ubrk_preceding(ptr_cast<UBreakIterator>(bi), offset);
|
||||
}
|
||||
|
||||
int32_t
|
||||
swift::__swift_stdlib_ubrk_following(swift::__swift_stdlib_UBreakIterator *bi,
|
||||
__swift_stdlib_ubrk_following(__swift_stdlib_UBreakIterator *bi,
|
||||
int32_t offset) {
|
||||
return ubrk_following(ptr_cast<UBreakIterator>(bi), offset);
|
||||
}
|
||||
|
||||
void swift::__swift_stdlib_ubrk_setText(
|
||||
swift::__swift_stdlib_UBreakIterator *bi, const __swift_stdlib_UChar *text,
|
||||
void __swift_stdlib_ubrk_setText(
|
||||
__swift_stdlib_UBreakIterator *bi, const __swift_stdlib_UChar *text,
|
||||
__swift_int32_t textLength, __swift_stdlib_UErrorCode *status) {
|
||||
return ubrk_setText(ptr_cast<UBreakIterator>(bi), ptr_cast<UChar>(text),
|
||||
textLength, ptr_cast<UErrorCode>(status));
|
||||
}
|
||||
|
||||
void swift::__swift_stdlib_ubrk_setUText(
|
||||
swift::__swift_stdlib_UBreakIterator *bi, __swift_stdlib_UText *text,
|
||||
void __swift_stdlib_ubrk_setUText(
|
||||
__swift_stdlib_UBreakIterator *bi, __swift_stdlib_UText *text,
|
||||
__swift_stdlib_UErrorCode *status) {
|
||||
return ubrk_setUText(ptr_cast<UBreakIterator>(bi), ptr_cast<UText>(text),
|
||||
ptr_cast<UErrorCode>(status));
|
||||
}
|
||||
|
||||
SWIFT_RUNTIME_STDLIB_API swift::__swift_stdlib_UText *
|
||||
swift::__swift_stdlib_utext_openUTF8(__swift_stdlib_UText *ut,
|
||||
SWIFT_RUNTIME_STDLIB_API __swift_stdlib_UText *
|
||||
__swift_stdlib_utext_openUTF8(__swift_stdlib_UText *ut,
|
||||
const char *s, int64_t len,
|
||||
__swift_stdlib_UErrorCode *status) {
|
||||
return ptr_cast<__swift_stdlib_UText>(
|
||||
@@ -200,8 +200,8 @@ swift::__swift_stdlib_utext_openUTF8(__swift_stdlib_UText *ut,
|
||||
ptr_cast<UErrorCode>(status)));
|
||||
}
|
||||
|
||||
SWIFT_RUNTIME_STDLIB_API swift::__swift_stdlib_UText *
|
||||
swift::__swift_stdlib_utext_openUChars(__swift_stdlib_UText *ut,
|
||||
SWIFT_RUNTIME_STDLIB_API __swift_stdlib_UText *
|
||||
__swift_stdlib_utext_openUChars(__swift_stdlib_UText *ut,
|
||||
const __swift_stdlib_UChar *s,
|
||||
int64_t len,
|
||||
__swift_stdlib_UErrorCode *status) {
|
||||
@@ -210,17 +210,17 @@ swift::__swift_stdlib_utext_openUChars(__swift_stdlib_UText *ut,
|
||||
ptr_cast<UErrorCode>(status)));
|
||||
}
|
||||
|
||||
swift::__swift_stdlib_UBool swift::__swift_stdlib_unorm2_hasBoundaryBefore(
|
||||
__swift_stdlib_UBool __swift_stdlib_unorm2_hasBoundaryBefore(
|
||||
const __swift_stdlib_UNormalizer2 *ptr, __swift_stdlib_UChar32 char32) {
|
||||
return unorm2_hasBoundaryBefore(ptr_cast<UNormalizer2>(ptr), char32);
|
||||
}
|
||||
const swift::__swift_stdlib_UNormalizer2 *
|
||||
swift::__swift_stdlib_unorm2_getNFCInstance(__swift_stdlib_UErrorCode *err) {
|
||||
const __swift_stdlib_UNormalizer2 *
|
||||
__swift_stdlib_unorm2_getNFCInstance(__swift_stdlib_UErrorCode *err) {
|
||||
return ptr_cast<__swift_stdlib_UNormalizer2>(
|
||||
unorm2_getNFCInstance(ptr_cast<UErrorCode>(err)));
|
||||
}
|
||||
|
||||
int32_t swift::__swift_stdlib_unorm2_normalize(
|
||||
int32_t __swift_stdlib_unorm2_normalize(
|
||||
const __swift_stdlib_UNormalizer2 *norm, const __swift_stdlib_UChar *src,
|
||||
__swift_int32_t len, __swift_stdlib_UChar *dst, __swift_int32_t capacity,
|
||||
__swift_stdlib_UErrorCode *err) {
|
||||
@@ -236,7 +236,7 @@ int32_t swift::__swift_stdlib_unorm2_normalize(
|
||||
#endif
|
||||
}
|
||||
|
||||
__swift_int32_t swift::__swift_stdlib_unorm2_spanQuickCheckYes(
|
||||
__swift_int32_t __swift_stdlib_unorm2_spanQuickCheckYes(
|
||||
const __swift_stdlib_UNormalizer2 *norm, const __swift_stdlib_UChar *ptr,
|
||||
__swift_int32_t len, __swift_stdlib_UErrorCode *err) {
|
||||
return unorm2_spanQuickCheckYes(ptr_cast<UNormalizer2>(norm),
|
||||
@@ -244,25 +244,25 @@ __swift_int32_t swift::__swift_stdlib_unorm2_spanQuickCheckYes(
|
||||
ptr_cast<UErrorCode>(err));
|
||||
}
|
||||
|
||||
swift::__swift_stdlib_UBool
|
||||
swift::__swift_stdlib_u_hasBinaryProperty(__swift_stdlib_UChar32 c,
|
||||
__swift_stdlib_UBool
|
||||
__swift_stdlib_u_hasBinaryProperty(__swift_stdlib_UChar32 c,
|
||||
__swift_stdlib_UProperty p) {
|
||||
return u_hasBinaryProperty(c, static_cast<UProperty>(p));
|
||||
}
|
||||
|
||||
void
|
||||
swift::__swift_stdlib_u_charAge(__swift_stdlib_UChar32 c,
|
||||
__swift_stdlib_u_charAge(__swift_stdlib_UChar32 c,
|
||||
__swift_stdlib_UVersionInfo versionInfo) {
|
||||
return u_charAge(c, versionInfo);
|
||||
}
|
||||
|
||||
__swift_int32_t
|
||||
swift::__swift_stdlib_u_getIntPropertyValue(__swift_stdlib_UChar32 c,
|
||||
__swift_stdlib_u_getIntPropertyValue(__swift_stdlib_UChar32 c,
|
||||
__swift_stdlib_UProperty p) {
|
||||
return u_getIntPropertyValue(c, static_cast<UProperty>(p));
|
||||
}
|
||||
|
||||
__swift_int32_t swift::__swift_stdlib_u_charName(
|
||||
__swift_int32_t __swift_stdlib_u_charName(
|
||||
__swift_stdlib_UChar32 code, __swift_stdlib_UCharNameChoice nameChoice,
|
||||
char *buffer, __swift_int32_t bufferLength,
|
||||
__swift_stdlib_UErrorCode *pErrorCode) {
|
||||
@@ -271,7 +271,7 @@ __swift_int32_t swift::__swift_stdlib_u_charName(
|
||||
ptr_cast<UErrorCode>(pErrorCode));
|
||||
}
|
||||
|
||||
__swift_int32_t swift::__swift_stdlib_u_strToLower(
|
||||
__swift_int32_t __swift_stdlib_u_strToLower(
|
||||
__swift_stdlib_UChar *dest, __swift_int32_t destCapacity,
|
||||
const __swift_stdlib_UChar *src, __swift_int32_t srcLength,
|
||||
const char *locale, __swift_stdlib_UErrorCode *pErrorCode) {
|
||||
@@ -280,7 +280,7 @@ __swift_int32_t swift::__swift_stdlib_u_strToLower(
|
||||
locale, ptr_cast<UErrorCode>(pErrorCode));
|
||||
}
|
||||
|
||||
__swift_int32_t swift::__swift_stdlib_u_strToTitle(
|
||||
__swift_int32_t __swift_stdlib_u_strToTitle(
|
||||
__swift_stdlib_UChar *dest, __swift_int32_t destCapacity,
|
||||
const __swift_stdlib_UChar *src, __swift_int32_t srcLength,
|
||||
__swift_stdlib_UBreakIterator *titleIter, const char *locale,
|
||||
@@ -291,7 +291,7 @@ __swift_int32_t swift::__swift_stdlib_u_strToTitle(
|
||||
ptr_cast<UErrorCode>(pErrorCode));
|
||||
}
|
||||
|
||||
__swift_int32_t swift::__swift_stdlib_u_strToUpper(
|
||||
__swift_int32_t __swift_stdlib_u_strToUpper(
|
||||
__swift_stdlib_UChar *dest, __swift_int32_t destCapacity,
|
||||
const __swift_stdlib_UChar *src, __swift_int32_t srcLength,
|
||||
const char *locale, __swift_stdlib_UErrorCode *pErrorCode) {
|
||||
@@ -300,7 +300,7 @@ __swift_int32_t swift::__swift_stdlib_u_strToUpper(
|
||||
locale, ptr_cast<UErrorCode>(pErrorCode));
|
||||
}
|
||||
|
||||
double swift::__swift_stdlib_u_getNumericValue(__swift_stdlib_UChar32 c) {
|
||||
double __swift_stdlib_u_getNumericValue(__swift_stdlib_UChar32 c) {
|
||||
return u_getNumericValue(c);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user