Skip to content

Commit ffa5aa3

Browse files
authored
Merge pull request #1133 from swiftwasm/master
[pull] swiftwasm from master
2 parents 6de866a + 71b2c50 commit ffa5aa3

File tree

170 files changed

+2208
-546
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

170 files changed

+2208
-546
lines changed

CMakeLists.txt

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,8 @@ endif()
413413

414414
if(MSVC OR "${CMAKE_SIMULATE_ID}" STREQUAL MSVC)
415415
include(ClangClCompileRules)
416+
elseif(UNIX)
417+
include(UnixCompileRules)
416418
endif()
417419

418420
if(CMAKE_C_COMPILER_ID MATCHES Clang)
@@ -432,19 +434,6 @@ if(SWIFT_BUILD_SYNTAXPARSERLIB OR SWIFT_BUILD_SOURCEKIT)
432434
endif()
433435
endif()
434436

435-
#
436-
# Assume a new enough ar to generate the index at construction time. This avoids
437-
# having to invoke ranlib as a secondary command.
438-
#
439-
440-
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> crs <TARGET> <LINK_FLAGS> <OBJECTS>")
441-
set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> qs <TARGET> <LINK_FLAGS> <OBJECTS>")
442-
set(CMAKE_C_ARCHIVE_FINISH "")
443-
444-
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> crs <TARGET> <LINK_FLAGS> <OBJECTS>")
445-
set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> qs <TARGET> <LINK_FLAGS> <OBJECTS>")
446-
set(CMAKE_CXX_ARCHIVE_FINISH "")
447-
448437
#
449438
# Include CMake modules
450439
#

cmake/modules/AddSwift.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,6 @@ function(add_swift_host_library name)
519519
endif()
520520

521521
set_target_properties(${name} PROPERTIES
522-
CXX_STANDARD 14
523522
NO_SONAME YES)
524523
endif()
525524

cmake/modules/UnixCompileRules.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
#
3+
# Assume a new enough ar to generate the index at construction time. This avoids
4+
# having to invoke ranlib as a secondary command.
5+
#
6+
7+
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> crs <TARGET> <LINK_FLAGS> <OBJECTS>")
8+
set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> qs <TARGET> <LINK_FLAGS> <OBJECTS>")
9+
set(CMAKE_C_ARCHIVE_FINISH "")
10+
11+
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> crs <TARGET> <LINK_FLAGS> <OBJECTS>")
12+
set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> qs <TARGET> <LINK_FLAGS> <OBJECTS>")
13+
set(CMAKE_CXX_ARCHIVE_FINISH "")

include/swift/AST/ASTPrinter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "swift/Basic/QuotedString.h"
1818
#include "swift/Basic/UUID.h"
1919
#include "swift/AST/Identifier.h"
20+
#include "llvm/ADT/SmallString.h"
2021
#include "llvm/ADT/StringRef.h"
2122
#include "llvm/ADT/DenseSet.h"
2223
#include "llvm/Support/raw_ostream.h"

include/swift/AST/AnyFunctionRef.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,20 @@ class AnyFunctionRef {
8989
return TheFunction.get<AbstractClosureExpr *>()->getSingleExpressionBody();
9090
}
9191

92+
void setSingleExpressionBody(Expr *expr) {
93+
if (auto *AFD = TheFunction.dyn_cast<AbstractFunctionDecl *>()) {
94+
AFD->setSingleExpressionBody(expr);
95+
return;
96+
}
97+
98+
auto ACE = TheFunction.get<AbstractClosureExpr *>();
99+
if (auto CE = dyn_cast<ClosureExpr>(ACE)) {
100+
CE->setSingleExpressionBody(expr);
101+
} else {
102+
cast<AutoClosureExpr>(ACE)->setBody(expr);
103+
}
104+
}
105+
92106
Type getType() const {
93107
if (auto *AFD = TheFunction.dyn_cast<AbstractFunctionDecl *>())
94108
return AFD->getInterfaceType();
@@ -123,6 +137,21 @@ class AnyFunctionRef {
123137
return cast<AutoClosureExpr>(ACE)->getBody();
124138
}
125139

140+
void setBody(BraceStmt *stmt, bool isSingleExpression) {
141+
if (auto *AFD = TheFunction.dyn_cast<AbstractFunctionDecl *>()) {
142+
AFD->setBody(stmt);
143+
AFD->setHasSingleExpressionBody(isSingleExpression);
144+
return;
145+
}
146+
147+
auto *ACE = TheFunction.get<AbstractClosureExpr *>();
148+
if (auto *CE = dyn_cast<ClosureExpr>(ACE)) {
149+
return CE->setBody(stmt, isSingleExpression);
150+
}
151+
152+
llvm_unreachable("autoclosures don't have statement bodies");
153+
}
154+
126155
DeclContext *getAsDeclContext() const {
127156
if (auto *AFD = TheFunction.dyn_cast<AbstractFunctionDecl *>())
128157
return AFD;

include/swift/AST/AnyRequest.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "swift/Basic/TypeID.h"
2323
#include "llvm/ADT/DenseMapInfo.h"
2424
#include "llvm/ADT/Hashing.h"
25+
#include "llvm/ADT/PointerIntPair.h"
2526
#include <string>
2627

2728
namespace llvm {

include/swift/AST/CaptureInfo.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include "llvm/ADT/PointerIntPair.h"
2323
#include "llvm/ADT/PointerUnion.h"
2424
#include "llvm/Support/TrailingObjects.h"
25-
#include <vector>
2625

2726
namespace swift {
2827
class CapturedValue;

include/swift/AST/ConcreteDeclRef.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include "swift/Basic/LLVM.h"
2222
#include "swift/AST/SubstitutionMap.h"
2323
#include "swift/AST/TypeAlignments.h"
24-
#include "llvm/ADT/ArrayRef.h"
2524
#include "llvm/ADT/PointerUnion.h"
2625
#include "llvm/Support/Compiler.h"
2726
#include <cstring>

include/swift/AST/Decl.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
#include "swift/Basic/OptionalEnum.h"
4242
#include "swift/Basic/Range.h"
4343
#include "swift/Basic/Located.h"
44-
#include "llvm/ADT/DenseMap.h"
4544
#include "llvm/ADT/DenseSet.h"
4645
#include "llvm/Support/TrailingObjects.h"
4746
#include <type_traits>

include/swift/AST/ExistentialLayout.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "swift/Basic/ArrayRefView.h"
2121
#include "swift/AST/ASTContext.h"
2222
#include "swift/AST/Type.h"
23-
#include "llvm/ADT/SmallVector.h"
2423

2524
namespace swift {
2625
class ProtocolDecl;

0 commit comments

Comments
 (0)