mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge remote-tracking branch 'origin/main' into rebranch
This commit is contained in:
@@ -133,7 +133,7 @@ static AccessorDecl *makeFieldSetterDecl(ClangImporter::Implementation &Impl,
|
||||
setterDecl->setIsDynamic(false);
|
||||
if (!isa<ClassDecl>(importedDecl))
|
||||
setterDecl->setSelfAccessKind(SelfAccessKind::Mutating);
|
||||
setterDecl->setAccess(importedFieldDecl->getFormalAccess());
|
||||
setterDecl->setAccess(importedFieldDecl->getSetterFormalAccess());
|
||||
|
||||
return setterDecl;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// RUN: %target-build-swift %t/reflect_task.swift.o %t/reflect_task.c.o -o %t/reflect_task
|
||||
// RUN: %target-codesign %t/reflect_task
|
||||
|
||||
// RUN: %target-run %target-swift-reflection-test %t/reflect_task | %FileCheck %s --dump-input=fail
|
||||
// RUN: %target-run %target-swift-reflection-test %t/reflect_task | %FileCheck %s --dump-input=always
|
||||
|
||||
// REQUIRES: reflection_test_support
|
||||
// REQUIRES: executable_test
|
||||
|
||||
32
test/Interop/Cxx/union/anonymous-union-const-member.swift
Normal file
32
test/Interop/Cxx/union/anonymous-union-const-member.swift
Normal file
@@ -0,0 +1,32 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: split-file %s %t
|
||||
// RUN: %target-swift-frontend -typecheck -verify -I %t/Inputs %t/main.swift
|
||||
// RUN: %target-swiftxx-frontend -typecheck -verify -I %t/Inputs %t/main.swift
|
||||
|
||||
// Import an anonymous union with const and non-const members. Constant members
|
||||
// appear within Foo as clang::IndirectFieldDecl and should be imported in Swift
|
||||
// as computed properties with private setters (since it is possible to change
|
||||
// the values of const members in C/C++).
|
||||
|
||||
//--- Inputs/module.modulemap
|
||||
module CxxModule { header "header.h" }
|
||||
|
||||
//--- Inputs/header.h
|
||||
#pragma once
|
||||
|
||||
struct Foo {
|
||||
union {
|
||||
const int constant;
|
||||
int variable;
|
||||
};
|
||||
};
|
||||
|
||||
//--- main.swift
|
||||
import CxxModule
|
||||
|
||||
func fooer(_ f: inout Foo) {
|
||||
let _ = f.variable
|
||||
let _ = f.constant
|
||||
f.variable = 42
|
||||
// f.constant = 42 // FIXME: this should not work (but currently does)
|
||||
}
|
||||
@@ -848,7 +848,7 @@ no-swift-stdlib-assertions
|
||||
[preset: mixin_linux_install_components_with_clang]
|
||||
|
||||
swift-install-components=autolink-driver;compiler;clang-resource-dir-symlink;libexec;stdlib;swift-remote-mirror;sdk-overlay;static-mirror-lib;toolchain-tools;license;sourcekit-inproc
|
||||
llvm-install-components=llvm-ar;llvm-ranlib;llvm-cov;llvm-profdata;llvm-objdump;llvm-objcopy;llvm-symbolizer;IndexStore;clang;clang-resource-headers;builtins;runtimes;clangd;libclang;lld;LTO;clang-features-file
|
||||
llvm-install-components=llvm-ar;llvm-nm;llvm-ranlib;llvm-cov;llvm-profdata;llvm-objdump;llvm-objcopy;llvm-symbolizer;IndexStore;clang;clang-resource-headers;builtins;runtimes;clangd;libclang;lld;LTO;clang-features-file
|
||||
|
||||
[preset: mixin_linux_installation]
|
||||
mixin-preset=
|
||||
|
||||
Reference in New Issue
Block a user