is implemented in Swift. ... Bridging SIL between C++ and Swift is toll-free, i.e. does not involve any "conversion" between C++ and Swift SIL. 2 https://github.com/apple/swift/tree/main/libswift 5
strong RC + unowned RC + flags OR HeapObjectSideTableEntry* } } } */ struct RefCountBitOffsets<8> { /* ---Immortal case--- All bits set, the object does not deallocate or have a refcount */ } 3 https://github.com/apple/swift/blob/main/stdlib/public/SwiftShims/RefCount.h 24
char *)str.data(), str.size() }; } /// Copies the string in an malloc'ed memory and the caller is responsible for /// freeing it. inline BridgedStringRef getCopiedBridgedStringRef(std::string str, bool removeTrailingNewline = false) { // A couple of mallocs are needed for passing a std::string to libswift. But // it's currently only used or debug descriptions. So, its' maybe not so bad - // for now. // TODO: find a better way to pass std::strings to libswift. StringRef strRef(str); if (removeTrailingNewline) strRef.consume_back("\n"); llvm::MallocAllocator allocator; StringRef copy = strRef.copy(allocator); return getBridgedStringRef(copy); } 44