mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 20:15:17 +00:00
AK: Add cxxCast template to allow Swift to perform simple checked casts
This is a workaround for the lack of support for imported class hierarchies in Swift. Swift's ClangImporter doesn't tell the Swift frontend about derived class relationships between imported types.
This commit is contained in:
parent
e4c88915ab
commit
4ab89d8bbb
Notes:
github-actions[bot]
2025-04-03 22:49:33 +00:00
Author: https://github.com/ADKaster Commit: https://github.com/LadybirdBrowser/ladybird/commit/4ab89d8bbbe Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4053
1 changed files with 8 additions and 0 deletions
|
@ -37,3 +37,11 @@
|
|||
# define SWIFT_RETURNS_RETAINED
|
||||
# define SWIFT_RETURNS_UNRETAINED
|
||||
#endif
|
||||
|
||||
// FIXME: This needs to be in the global namespace for reasons
|
||||
// https://github.com/swiftlang/swift/issues/80231
|
||||
template<class From, class To>
|
||||
To cxxCast(From i)
|
||||
{
|
||||
return static_cast<To>(i);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue