Skip to content

Commit 16c320d

Browse files
authored
Merge pull request #2082 from swiftwasm/main
[pull] swiftwasm from main
2 parents 95bf4b0 + b385332 commit 16c320d

File tree

17 files changed

+84
-41
lines changed

17 files changed

+84
-41
lines changed

docs/Driver.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ in becoming more like non-whole-module builds.
205205

206206
## Incremental Builds ##
207207

208-
Incremental builds in Swift work by primarily by cross-file dependency
208+
Incremental builds in Swift work primarily by cross-file dependency
209209
analysis, described in [DependencyAnalysis.md](DependencyAnalysis.md).
210210
Compiling a single file might be necessary because that file has changed, but
211211
it could also be because that file depends on something else that might have

lib/ClangImporter/ImportDecl.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,7 +1390,8 @@ createValueConstructor(ClangImporter::Implementation &Impl,
13901390
continue;
13911391

13921392
if (auto clangField = dyn_cast<clang::FieldDecl>(var->getClangDecl()))
1393-
if (clangField->isAnonymousStructOrUnion())
1393+
if (clangField->isAnonymousStructOrUnion() ||
1394+
clangField->getDeclName().isEmpty())
13941395
generateParamName = false;
13951396
}
13961397

@@ -2397,6 +2398,8 @@ namespace {
23972398
if (field->isAnonymousStructOrUnion()) {
23982399
IdStream << "__Anonymous_field" << field->getFieldIndex();
23992400
} else {
2401+
assert(!field->getDeclName().isEmpty() &&
2402+
"Microsoft anonymous struct extension?");
24002403
IdStream << field->getName();
24012404
}
24022405
ImportedName Result;
@@ -4011,7 +4014,7 @@ namespace {
40114014
Optional<ImportedName> correctSwiftName;
40124015
ImportedName importedName;
40134016

4014-
if (!decl->isAnonymousStructOrUnion()) {
4017+
if (!decl->isAnonymousStructOrUnion() && !decl->getDeclName().isEmpty()) {
40154018
importedName = importFullName(decl, correctSwiftName);
40164019
if (!importedName) {
40174020
return nullptr;

lib/SILOptimizer/PassManager/PassPipeline.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,8 @@ void addFunctionPasses(SILPassPipelinePlan &P,
300300
P.addMem2Reg();
301301

302302
// We earlier eliminated ownership if we are not compiling the stdlib. Now
303-
// handle the stdlib functions.
303+
// handle the stdlib functions, re-simplifying, eliminating ARC as we do.
304+
P.addSemanticARCOpts();
304305
P.addNonTransparentFunctionOwnershipModelEliminator();
305306

306307
// Run the existential specializer Pass.

lib/SILOptimizer/SemanticARC/SemanticARCOpts.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,10 @@ struct SemanticARCOpts : SILFunctionTransform {
100100
void run() override {
101101
SILFunction &f = *getFunction();
102102

103-
// Return early if we are not performing OSSA optimizations.
104-
if (!f.getModule().getOptions().EnableOSSAOptimizations)
103+
// Return early if we are not performing OSSA optimizations or we are not in
104+
// ownership.
105+
if (!f.getModule().getOptions().EnableOSSAOptimizations ||
106+
!f.hasOwnership())
105107
return;
106108

107109
// Make sure we are running with ownership verification enabled.

stdlib/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ option(SWIFT_STDLIB_OS_VERSIONING
6969
"Build stdlib with availability based on OS versions (Darwin only)."
7070
TRUE)
7171

72-
option(SWIFT_COMPILE_DIFFERENTIATION_WITHOUT_TGMATH
73-
"Build Differentation without tgmath (and dependency on platform runtime libraries)"
74-
FALSE)
75-
7672
#
7773
# End of user-configurable options.
7874
#

stdlib/public/CMakeLists.txt

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,7 @@ if(SWIFT_BUILD_STDLIB)
9595
endif()
9696

9797
if(SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING)
98-
if(SWIFT_COMPILE_DIFFERENTIATION_WITHOUT_TGMATH)
99-
# Use a different CMakeLists.txt for this configuration
100-
# while sharing the bulk of the code
101-
# This way we will reduce any side effect on the main configuration
102-
# and increase the readability of the CMake code
103-
add_subdirectory(Differentiation_NoTgMath)
104-
else()
105-
add_subdirectory(Differentiation)
106-
endif()
98+
add_subdirectory(Differentiation)
10799
endif()
108100

109101
if(SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY)

stdlib/public/Differentiation_NoTgMath/CMakeLists.txt

Lines changed: 0 additions & 20 deletions
This file was deleted.

stdlib/public/SwiftShims/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ endif()
223223
# need to use a different version of the headers than the installed Clang. This
224224
# should be used in conjunction with clang-resource-dir-symlink.
225225
file(TO_CMAKE_PATH "${LLVM_LIBRARY_OUTPUT_INTDIR}"
226-
_SWIFT_SHIMS_PATH_TO_CLANG_BUILD)
227-
swift_install_in_component(DIRECTORY "${_SWIFT_SHIMS_PATH_TO_CLANG_BUILD}/lib/clang"
226+
_SWIFT_SHIMS_PATH_TO_CLANG_LIB_BUILD)
227+
swift_install_in_component(DIRECTORY "${_SWIFT_SHIMS_PATH_TO_CLANG_LIB_BUILD}/clang"
228228
DESTINATION "lib"
229229
COMPONENT clang-builtin-headers-in-clang-resource-dir
230230
PATTERN "*.h")
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
typedef struct S {
3+
unsigned char uc;
4+
} S;
5+
6+
typedef struct T {
7+
S;
8+
} T;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// RUN: %target-swift-frontend -Xcc -fms-extensions -import-objc-header %S/Inputs/ctypes_msvc.h -typecheck -verify %s
2+
3+
_ = T().uc
4+
_ = T(S(uc: 0))

0 commit comments

Comments
 (0)