mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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`).
8 lines
367 B
Swift
8 lines
367 B
Swift
// RUN: %target-swift-ide-test -print-module -module-to-print=MutabilityAnnotations -I %S/Inputs -source-filename=x -enable-cxx-interop | %FileCheck %s
|
|
|
|
// CHECK: struct HasConstMethodAnnotatedAsMutating {
|
|
// CHECK: mutating func annotatedMutating() -> Int32
|
|
// CHECK: mutating func annotatedMutatingWithOtherAttrs() -> Int32
|
|
// CHECK: var a: Int32
|
|
// CHECK: }
|