Commit Graph

12 Commits

Author SHA1 Message Date
Hamish Knight
ce23252a3f [Basic] Improve some bridging APIs
Improve APIs for BridgedStringRef,
BridgedOwnedString, and BridgedSourceLoc.
2023-10-30 23:49:53 +00:00
Erik Eckstein
22979b9a7a fix an uninitialized pointer in BridgedSourceLoc
It's so easy to run into undefined behavior in C++
2023-10-09 17:32:51 +02:00
Erik Eckstein
2dbd6cc56b SwiftCompilerSources: rework bridging
Introduce two modes of bridging:
* inline mode: this is basically how it worked so far. Using full C++ interop which allows bridging functions to be inlined.
* pure mode: bridging functions are not inlined but compiled in a cpp file. This allows to reduce the C++ interop requirements to a minimum. No std/llvm/swift headers are imported.

This change requires a major refactoring of bridging sources. The implementation of bridging functions go to two separate files: SILBridgingImpl.h and OptimizerBridgingImpl.h.
Depending on the mode, those files are either included in the corresponding header files (inline mode), or included in the c++ file (pure mode).

The mode can be selected with the BRIDGING_MODE cmake variable. By default it is set to the inline mode (= existing behavior). The pure mode is only selected in certain configurations to work around C++ interop issues:
* In debug builds, to workaround a problem with LLDB's `po` command (rdar://115770255).
* On windows to workaround a build problem.
2023-10-09 09:52:52 +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
zoecarver
12933bf3b4 Mark a few API uses in Swift Compiler Sources as unsafe. 2022-07-18 20:06:43 -04:00
Egor Zhdan
220d95e3d9 [cxx-interop][SwiftCompilerSources] Use swift::CharSourceRange instead of BridgedCharSourceRange
This removes some of the bridging code and replaces it with C++ calls.

rdar://83361087
2022-07-07 12:00:12 +01:00
Alexis Laferrière
e7b1434ed2 [SwiftCompilerSources] Add missing import 2022-06-30 12:56:46 -07:00
Egor Zhdan
038a4f0b80 [cxx-interop][SwiftCompilerSources] Use swift::SourceLoc instead of BridgedSourceLoc
C++ interop is now enabled in SwiftCompilerSources, so we can remove some of the C bridging layer and use C++ classes directly from Swift.

rdar://83361087
2022-06-11 00:13:39 +01:00
Josh Soref
66663b1286 Spelling basic (#42541)
* spelling: add

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: attributes

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: bridging

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: deserialization

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: initialize

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: invariants

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: lazily

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: occurred

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: offset

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: optimization

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: our

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: process

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: substitution

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: the operation

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: the

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-05-04 14:53:24 -07:00
Rintaro Ishizaki
d292a95296 [SwiftCompiler/Regex] Use bridged DiagnosticEngine for error reporting
This fixes:
 * An issue where the diagnostic messages were leaked
 * Diagnose at correct position inside the regex literal

To do this:
 * Introduce 'Parse' SwiftCompiler module that is a bridging layer
   between '_CompilerRegexParser' and C++ libParse
 * Move libswiftParseRegexLiteral and libswiftLexRegexLiteral to 'Parse'

Also this change makes 'SwiftCompilerSources/Package.swift' be configured
by CMake so it can actually be built with 'swift-build'.

rdar://92187284
2022-04-22 22:53:46 -07:00
Rintaro Ishizaki
4d9b65d961 [SwiftCompiler] Add DiagnosticEngine bridging
* 'SourceLoc' and 'CharSourceRange' bridging in Basic
* New 'AST' bridging. 'DiagID', 'DiagnosticArgument', 'DiagnosticFixIt',
  and 'DiagnosticEngine'
2022-02-23 15:57:33 -08:00