Skip to content

Commit dcd83a8

Browse files
committed
[nfc][cxx-interop] Rename cxx-compatibility-mode -> cxx-interoperability-mode.
1 parent b64b52a commit dcd83a8

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

docs/CppInteroperability/GettingStartedWithC++Interop.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ After creating your Swift package project, follow the steps [Creating a Module t
8181
- Swift code will be in `Sources/CxxInterop` called `main.swift`
8282
- C++ source code follows the example shown in [Creating a Module to contain your C++ source code](#creating-a-module-to-contain-your-c-source-code)
8383
- Under targets, add the name of your C++ module and the directory containing the Swift code as a target.
84-
- In the target defining your Swift target, add a`dependencies` to the C++ Module, the `path`, `source`, and `swiftSettings` with `unsafeFlags` with the source to the C++ Module, and enable `-cxx-compatibility-mode=swift-5.7`
84+
- In the target defining your Swift target, add a`dependencies` to the C++ Module, the `path`, `source`, and `swiftSettings` with `unsafeFlags` with the source to the C++ Module, and enable `-cxx-interoperability-mode=swift-5.7`
8585

8686
```
8787
//In Package Manifest
@@ -111,7 +111,7 @@ let package = Package(
111111
sources: [ "main.swift" ],
112112
swiftSettings: [.unsafeFlags([
113113
"-I", "Sources/CxxTest",
114-
"-cxx-compatibility-mode=swift-5.7",
114+
"-cxx-interoperability-mode=swift-5.7",
115115
])]
116116
),
117117
]
@@ -144,7 +144,7 @@ After creating your project follow the steps [Creating a Module to contain your
144144
- Create a `CMakeLists.txt` file and configure for your project
145145
- In`add_library` invoke `cxx-support` with the path to the C++ implementation file
146146
- Add the `target_include_directories` with `cxx-support` and path to the C++ Module `${CMAKE_SOURCE_DIR}/Sources/CxxTest`
147-
- Add the `add_executable` to the specific files/directory you would like to generate source, with`SHELL:-cxx-compatibility-mode=swift-5.7`.
147+
- Add the `add_executable` to the specific files/directory you would like to generate source, with`SHELL:-cxx-interoperability-mode=swift-5.7`.
148148
- In the example below we will be following the file structure used in [Creating a Swift Package](#Creating-a-Swift-Package)
149149

150150
```
@@ -167,7 +167,7 @@ target_include_directories(cxx-support PUBLIC
167167
168168
add_executable(CxxInterop ./Sources/CxxInterop/main.swift)
169169
target_compile_options(CxxInterop PRIVATE
170-
"SHELL:-cxx-compatibility-mode=swift-5.7"
170+
"SHELL:-cxx-interoperability-mode=swift-5.7"
171171
target_link_libraries(CxxInterop PRIVATE cxx-support)
172172
173173
```

include/swift/AST/DiagnosticsFrontend.def

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -516,18 +516,18 @@ WARNING(compiler_plugin_not_loaded,none,
516516

517517
ERROR(dont_enable_interop_and_compat,none,
518518
"do not pass both -enable-experimental-cxx-interop and "
519-
"-cxx-compatibility-mode. Remove -enable-experimental-cxx-interop.", ())
519+
"-cxx-interoperability-mode. Remove -enable-experimental-cxx-interop.", ())
520520

521521
ERROR(invalid_interop_compat_mode,none,
522-
"invalid option passed to -cxx-compatibility-mode. Please select either "
522+
"invalid option passed to -cxx-interoperability-mode. Please select either "
523523
"'off' or 'swift-5.7'.", ())
524524
NOTE(swift_will_maintain_compat,none,
525525
"Swift will maintain source compatibility for imported APIs based on the "
526526
"selected compatibility mode, so updating the Swift compiler will not "
527527
"change how APIs are imported.", ())
528528
WARNING(enable_interop_flag_deprecated,none,
529529
"the -enable-experimental-cxx-interop flag is deprecated. Please pass "
530-
"'-cxx-compatibility-mode=' instead.", ())
530+
"'-cxx-interoperability-mode=' instead.", ())
531531

532532
#define UNDEFINE_DIAGNOSTIC_MACROS
533533
#include "DefineDiagnosticMacros.h"

include/swift/Option/Options.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,8 +666,8 @@ def enable_experimental_cxx_interop :
666666
Flags<[NoDriverOption, FrontendOption, HelpHidden, ModuleInterfaceOption]>,
667667
HelpText<"Enable experimental C++ interop code generation and config directives">;
668668

669-
def cxx_compatibility_mode :
670-
Joined<["-"], "cxx-compatibility-mode=">,
669+
def cxx_interoperability_mode :
670+
Joined<["-"], "cxx-interoperability-mode=">,
671671
Flags<[FrontendOption, ModuleInterfaceOption]>,
672672
HelpText<"Enables C++ interoperability; requires compatbility version to be"
673673
"specified.">;

lib/Driver/ToolChains.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ void ToolChain::addCommonFrontendArgs(const OutputInfo &OI,
305305
inputArgs.AddLastArg(arguments, options::OPT_library_level);
306306
inputArgs.AddLastArg(arguments, options::OPT_enable_bare_slash_regex);
307307
inputArgs.AddLastArg(arguments, options::OPT_enable_experimental_cxx_interop);
308-
inputArgs.AddLastArg(arguments, options::OPT_cxx_compatibility_mode);
308+
inputArgs.AddLastArg(arguments, options::OPT_cxx_interoperability_mode);
309309
inputArgs.AddLastArg(arguments, options::OPT_load_plugin_library);
310310
inputArgs.AddLastArg(arguments, options::OPT_load_plugin_executable);
311311
inputArgs.AddLastArg(arguments, options::OPT_enable_builtin_module);

lib/Frontend/CompilerInvocation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
913913
Opts.ClangTarget = llvm::Triple(A->getValue());
914914
}
915915

916-
if (Arg *A = Args.getLastArg(OPT_cxx_compatibility_mode)) {
916+
if (Arg *A = Args.getLastArg(OPT_cxx_interoperability_mode)) {
917917
if (Args.hasArg(OPT_enable_experimental_cxx_interop)) {
918918
Diags.diagnose(SourceLoc(), diag::dont_enable_interop_and_compat);
919919
}

test/lit.cfg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -727,8 +727,8 @@ elif swift_test_mode == 'with_cxx_interop':
727727
config.available_features.add("nonexecutable_test")
728728
config.available_features.add("executable_test")
729729
config.available_features.add("with_cxx_interop")
730-
config.swift_frontend_test_options += ' -cxx-compatibility-mode=swift-5.7'
731-
config.swift_driver_test_options += ' -cxx-compatibility-mode=swift-5.7'
730+
config.swift_frontend_test_options += ' -cxx-interoperability-mode=swift-5.7'
731+
config.swift_driver_test_options += ' -cxx-interoperability-mode=swift-5.7'
732732
else:
733733
lit_config.fatal("Unknown test mode %r" % swift_test_mode)
734734

@@ -2381,7 +2381,7 @@ config.substitutions.insert(0, ('%check-cxx-header-in-clang',
23812381
config.substitutions.append(('%env-', config.target_env_prefix))
23822382

23832383
config.substitutions.append(('%target-clangxx', '%s -std=c++11' % config.target_clang))
2384-
config.substitutions.append(('%target-swiftxx-frontend', '%s -cxx-compatibility-mode=swift-5.7' % config.target_swift_frontend))
2384+
config.substitutions.append(('%target-swiftxx-frontend', '%s -cxx-interoperability-mode=swift-5.7' % config.target_swift_frontend))
23852385

23862386
config.substitutions.append(('%target-runtime', config.target_runtime))
23872387

0 commit comments

Comments
 (0)