Commit Graph

20 Commits

Author SHA1 Message Date
Erik Eckstein
45963939dd SwiftCompilerSources: fix a compiler error when building with hosttools
Fixes a simple copy-paste error, introduced in https://github.com/apple/swift/pull/67296
2023-07-20 16:50:26 +02:00
zoecarver
782641af68 [cxx-interop] ExpirementalFeature -> LanguageFeature. 2023-07-18 17:42:35 -07:00
zoecarver
2115f7aaf8 [cxx-interop] Add NewCxxMethodSafetyHeuristics feature and guard swift compiler sources changes on it. 2023-07-18 17:42:34 -07:00
Erik Eckstein
ee1c52bc77 Swift SIL: add some APIs 2023-05-22 15:34:26 +02:00
Erik Eckstein
86444a3c8d Swift SIL: don't use Unmanaged to convert between bridged and native SIL objects.
Looking at the SIL I came to the conclusion that `Unmanaged` ins fundamentally broken.
It's easier to directly bitcast between bridged and native SIL objects. It also produces simpler SIL which can be further optimized
2023-03-14 21:07:03 +01:00
Egor Zhdan
7203a05479 [cxx-interop] Replace std module name with the new spelling CxxStdlib
This is the second step in renaming the C++ stdlib module `std` into `CxxStdlib`.

See https://github.com/apple/swift/pull/61099.
2022-11-29 17:33:35 +00:00
Erik Eckstein
b5b055adcb Swift Utils: make StringRef matchable in patterns
By adding a `~=` operator with `StaticString`
2022-10-20 09:20:28 +02:00
Erik Eckstein
732f0c9416 Swift Utils: remove a left over debug log message 2022-10-17 11:44:30 +02:00
Erik Eckstein
aea26bbc6e Swift SIL: add a utility protocol NoReflectionChildren for better debug output with lldb po
Let's lldb's `po` command not print any "internal" properties of the conforming type.
This is useful if the `description` already contains all the information of a type instance.
2022-10-05 07:37:41 +02:00
Erik Eckstein
984ae9e4f1 Define our own assert implementation for the swift compiler sources
For two reasons:
* We also like to check for assert failures in release builds. Although this could be achieved with `precondition`, it's easy to forget about it and use `assert` instead.
* We need to see the error message in crashlogs of release builds. This is even not the case for `precondition`.

Also, re-export the "Basic" module in "SIL" so that the new assert implementation is also available in the Optimizer module (where all files import SIL).
2022-09-14 14:16:26 +02:00
Egor Zhdan
0e2d438c5b [cxx-interop][SwiftCompilerSources] Use llvm::StringRef instead of BridgedStringRef
rdar://83361000
2022-07-21 16:32:16 +01:00
zoecarver
12933bf3b4 Mark a few API uses in Swift Compiler Sources as unsafe. 2022-07-18 20:06:43 -04:00
Egor Zhdan
1ae44e77a5 [cxx-interop][SwiftCompilerSources] Use DiagnosticInfo::FixIt instead of BridgedDiagnosticFixIt
This removes some of the bridging code and replaces it with C++ calls.

rdar://83361087
2022-07-12 16:54:16 +01:00
Egor Zhdan
38edc7f377 [cxx-interop][SwiftCompilerSources] Remove getCopiedBridgedStringRef and freeBridgedStringRef
`std::string`s can now be passed directly between Swift and C++.

rdar://83361087
2022-07-06 12:57:50 +01:00
Egor Zhdan
ffb9ee9422 Revert "Revert "[cxx-interop][SwiftCompilerSources] Fix conversion between std::string and Swift.String""
This reverts commit 9542837a18.
2022-06-09 23:40:51 +01:00
Egor Zhdan
9542837a18 Revert "[cxx-interop][SwiftCompilerSources] Fix conversion between std::string and Swift.String"
This reverts commit be711e387f.
2022-06-08 14:10:04 +01:00
Egor Zhdan
be711e387f [cxx-interop][SwiftCompilerSources] Fix conversion between std::string and Swift.String
This fixes a dangling pointer issue when creating a `Swift.String` from `std::string`.

Also fixes a warning:
```
warning: variable 's' was never mutated; consider changing to 'let' constant
    var s = SILBasicBlock_debugDescription(bridged)
    ~~~ ^
    let
```

rdar://92963081
rdar://93053488
2022-05-30 20:06:36 +01:00
Erik Eckstein
cd456fa792 Swift SIL: make Function.name and GlobalVariable.name return a StringRef and not a String
and introduce the StringRef struct.
It's more efficient.

Also, rename the `HasName` protocol to `HasShortDescription`, which introduces the new requirement `shortDescription`. This is need because `name` now has `StringRef` type and not `String` anymore
2022-05-12 21:48:37 +02:00
Rintaro Ishizaki
da6814d510 [SwiftCompiler] Make BridgedArrayRef.data nullable
ArrayRef.data() can be nullptr when the array is empty.
2022-02-20 22:30:18 -08:00
Rintaro Ishizaki
7486cd1c21 [SwiftCompiler] Move common bridging facilities to 'Basic'
A preparation for AST/DiagnosticEngine bridging
2022-02-20 22:06:39 -08:00