Commit Graph

6 Commits

Author SHA1 Message Date
Egor Zhdan
7db3666e43 [cxx-interop] Fix test/Interop/Cxx/stdlib/use-std-string.swift
Temporarily disable the checks for mutable fields in a C++ struct. A better solution would be to use some heuristic to detect if a method mutates a mutable field, and allow the user to adjust mutability with the existing `nonmutating` annotation.

rdar://92621793
2022-05-03 16:36:40 +01:00
Sam Kortekaas
91bc7534ea [cxx-interop] Add diagnostics for nonmutating attr that has no effect 2022-04-28 15:42:56 +02:00
Sam Kortekaas
23b2fa9753 [cxx-interop] Add diagnostic for contradicting mutability annotations 2022-04-28 15:42:56 +02:00
Sam Kortekaas
60fe6aae95 [cxx-interop] Add a "nonmutating" swift_attr attribute
Previously, the clang importer marked all const methods as mutating whenever a C++ record had mutable fields. This change allows overriding this behavior by using the "nonmutating" swift_attr attribute.

Fixes SR-15907.
2022-04-28 15:42:56 +02:00
zoecarver
839839f924 [cxx-interop] Rename enable-cxx-interop -> enable-experimental-cxx-interop.
Also removes the driver flag, this will now also always be guarded on `-Xfrontend`.
2022-04-07 19:15:25 -07:00
Egor Zhdan
06612934e8 C++ Interop: support mutating attribute for C++ methods
This change teaches ClangImporter to import C++ methods marked with `__attribute__((__swift_attr__("mutating")))` as mutating in Swift. This is useful, for example, when a method mutates `this` despite being `const` in C++ (e.g. via `const_cast`).
2021-11-29 21:13:16 +03:00