Skip to content

Commit ec58843

Browse files
Merge pull request #2986 from swiftwasm/katei/merge-main-2021-04-15
Merge main 2021-04-15
2 parents f991732 + 5f8b3bd commit ec58843

File tree

288 files changed

+2731
-1734
lines changed

Some content is hidden

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

288 files changed

+2731
-1734
lines changed

docs/SIL.rst

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1862,7 +1862,7 @@ derived from the ARC object. As an example, consider the following Swift/SIL::
18621862
bb0(%0 : @guaranteed Klass):
18631863
// Definition of '%1'
18641864
%1 = copy_value %0 : $Klass
1865-
1865+
18661866
// Consume '%1'. This means '%1' can no longer be used after this point. We
18671867
// rebind '%1' in the destination blocks (bbYes, bbNo).
18681868
checked_cast_br %1 : $Klass to $OtherKlass, bbYes, bbNo
@@ -3319,6 +3319,24 @@ lowered by the SIL pipeline, so that IR generation only operands of type
33193319

33203320
The operand is a guaranteed operand, i.e. not consumed.
33213321

3322+
extract_executor
3323+
````````````````
3324+
3325+
::
3326+
3327+
sil-instruction ::= 'extract_executor' sil-operand
3328+
3329+
%1 = extract_executor %0 : $T
3330+
// $T must be Builtin.Executor or conform to the Actor protocol
3331+
// %1 will be of type Builtin.Executor
3332+
3333+
Extracts the executor from the executor or actor operand. SIL generation
3334+
emits this instruction to produce executor values when needed (e.g.,
3335+
to provide to a runtime function). It will be lowered away by the SIL
3336+
pipeline.
3337+
3338+
The operand is a guaranteed operand, i.e. not consumed.
3339+
33223340
dealloc_stack
33233341
`````````````
33243342
::

include/swift/AST/DiagnosticsSema.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ ERROR(sema_no_import,Fatal,
704704
"no such module '%0'", (StringRef))
705705
ERROR(sema_no_import_target,Fatal,
706706
"could not find module '%0' for target '%1'; "
707-
"found: %2", (StringRef, StringRef, StringRef))
707+
"found: %2, at: %3", (StringRef, StringRef, StringRef, StringRef))
708708
ERROR(sema_no_import_repl,none,
709709
"no such module '%0'", (StringRef))
710710
NOTE(sema_no_import_no_sdk,none,

include/swift/AST/FileUnit.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#define SWIFT_AST_FILEUNIT_H
1515

1616
#include "swift/AST/Module.h"
17+
#include "swift/AST/RawComment.h"
18+
#include "swift/Basic/BasicSourceInfo.h"
1719

1820
namespace swift {
1921
static inline unsigned alignOfFileUnit();

include/swift/AST/Module.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
#include "swift/AST/Identifier.h"
2424
#include "swift/AST/Import.h"
2525
#include "swift/AST/LookupKinds.h"
26-
#include "swift/AST/RawComment.h"
2726
#include "swift/AST/Type.h"
27+
#include "swift/Basic/BasicSourceInfo.h"
2828
#include "swift/Basic/Compiler.h"
2929
#include "swift/Basic/OptionSet.h"
3030
#include "swift/Basic/STLExtras.h"

include/swift/AST/NameLookup.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "swift/Basic/Debug.h"
2626
#include "swift/Basic/NullablePtr.h"
2727
#include "swift/Basic/SourceLoc.h"
28+
#include "swift/Basic/SourceManager.h"
2829

2930
namespace swift {
3031
class ASTContext;

include/swift/AST/PrintOptions.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,7 @@ struct PrintOptions {
510510
result.PrintDocumentationComments = true;
511511
result.PrintRegularClangComments = true;
512512
result.PrintLongAttrsOnSeparateLines = true;
513+
result.AlwaysTryPrintParameterLabels = true;
513514
return result;
514515
}
515516

@@ -655,6 +656,7 @@ struct PrintOptions {
655656
PO.ShouldQualifyNestedDeclarations = QualifyNestedDeclarations::TypesOnly;
656657
PO.PrintParameterSpecifiers = true;
657658
PO.SkipImplicit = true;
659+
PO.AlwaysTryPrintParameterLabels = true;
658660
return PO;
659661
}
660662
};

include/swift/AST/RawComment.h

Lines changed: 3 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
#ifndef SWIFT_AST_RAW_COMMENT_H
1414
#define SWIFT_AST_RAW_COMMENT_H
1515

16-
#include "swift/Basic/Fingerprint.h"
17-
#include "swift/Basic/LLVM.h"
1816
#include "swift/Basic/SourceLoc.h"
19-
#include "swift/Basic/SourceManager.h"
17+
#include "llvm/ADT/ArrayRef.h"
18+
#include "llvm/ADT/StringRef.h"
2019

2120
namespace swift {
2221

2322
class SourceFile;
23+
class SourceManager;
2424

2525
struct SingleRawComment {
2626
enum class CommentKind {
@@ -82,78 +82,6 @@ struct CommentInfo {
8282
uint32_t SourceOrder;
8383
};
8484

85-
struct LineColumn {
86-
uint32_t Line = 0;
87-
uint32_t Column = 0;
88-
bool isValid() const { return Line && Column; }
89-
};
90-
91-
struct BasicDeclLocs {
92-
StringRef SourceFilePath;
93-
SmallVector<std::pair<LineColumn, uint32_t>, 4> DocRanges;
94-
LineColumn Loc;
95-
LineColumn StartLoc;
96-
LineColumn EndLoc;
97-
};
98-
99-
class BasicSourceFileInfo {
100-
/// If this is non-null, fields other than 'FilePath' hasn't been populated.
101-
/// The 'getInt()' part indicates this instance is constructed with a
102-
/// SourceFile.
103-
llvm::PointerIntPair<const SourceFile *, 1, bool> SFAndIsFromSF;
104-
105-
StringRef FilePath;
106-
Fingerprint InterfaceHashIncludingTypeMembers = Fingerprint::ZERO();
107-
/// Does *not* include the type-body hashes of the top level types.
108-
/// Just the `SourceFile` hashes.
109-
/// Used for incremental imports.
110-
Fingerprint InterfaceHashExcludingTypeMembers = Fingerprint::ZERO();
111-
llvm::sys::TimePoint<> LastModified = {};
112-
uint64_t FileSize = 0;
113-
114-
// Populate the from 'SF' member if exist. 'SF' will be cleared.
115-
void populateWithSourceFileIfNeeded();
116-
117-
public:
118-
BasicSourceFileInfo(StringRef FilePath,
119-
Fingerprint InterfaceHashIncludingTypeMembers,
120-
Fingerprint InterfaceHashExcludingTypeMembers,
121-
llvm::sys::TimePoint<> LastModified, uint64_t FileSize)
122-
: FilePath(FilePath),
123-
InterfaceHashIncludingTypeMembers(InterfaceHashIncludingTypeMembers),
124-
InterfaceHashExcludingTypeMembers(InterfaceHashExcludingTypeMembers),
125-
LastModified(LastModified), FileSize(FileSize) {}
126-
127-
/// Construct with a `SourceFile`. `getInterfaceHashIncludingTypeMembers()`,
128-
/// `getInterfaceHashExcludingTypeMembers()`, `getLastModified()` and `getFileSize()` are laizily
129-
/// populated when accessed.
130-
BasicSourceFileInfo(const SourceFile *SF);
131-
132-
bool isFromSourceFile() const;
133-
134-
StringRef getFilePath() const { return FilePath; }
135-
136-
Fingerprint getInterfaceHashIncludingTypeMembers() const {
137-
const_cast<BasicSourceFileInfo *>(this)->populateWithSourceFileIfNeeded();
138-
return InterfaceHashIncludingTypeMembers;
139-
}
140-
141-
Fingerprint getInterfaceHashExcludingTypeMembers() const {
142-
const_cast<BasicSourceFileInfo *>(this)->populateWithSourceFileIfNeeded();
143-
return InterfaceHashExcludingTypeMembers;
144-
}
145-
146-
llvm::sys::TimePoint<> getLastModified() const {
147-
const_cast<BasicSourceFileInfo *>(this)->populateWithSourceFileIfNeeded();
148-
return LastModified;
149-
}
150-
151-
uint64_t getFileSize() const {
152-
const_cast<BasicSourceFileInfo *>(this)->populateWithSourceFileIfNeeded();
153-
return FileSize;
154-
}
155-
};
156-
15785
} // namespace swift
15886

15987
#endif // LLVM_SWIFT_AST_RAW_COMMENT_H

include/swift/Basic/BasicSourceInfo.h

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
//===--- BasicSourceInfo.h - Simple source information ----------*- C++ -*-===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
#ifndef SWIFT_BASIC_BASIC_SOURCE_INFO_H
14+
#define SWIFT_BASIC_BASIC_SOURCE_INFO_H
15+
16+
#include "swift/Basic/Fingerprint.h"
17+
#include "swift/Basic/LLVM.h"
18+
#include "llvm/ADT/PointerIntPair.h"
19+
#include "llvm/Support/Chrono.h"
20+
21+
namespace swift {
22+
23+
class SourceFile;
24+
25+
struct SourcePosition {
26+
uint32_t Line = 0;
27+
uint32_t Column = 0;
28+
bool isValid() const { return Line && Column; }
29+
};
30+
31+
struct BasicDeclLocs {
32+
StringRef SourceFilePath;
33+
SmallVector<std::pair<SourcePosition, uint32_t>, 4> DocRanges;
34+
SourcePosition Loc;
35+
SourcePosition StartLoc;
36+
SourcePosition EndLoc;
37+
};
38+
39+
class BasicSourceFileInfo {
40+
/// If this is non-null, fields other than 'FilePath' hasn't been populated.
41+
/// The 'getInt()' part indicates this instance is constructed with a
42+
/// SourceFile.
43+
llvm::PointerIntPair<const SourceFile *, 1, bool> SFAndIsFromSF;
44+
45+
StringRef FilePath;
46+
Fingerprint InterfaceHashIncludingTypeMembers = Fingerprint::ZERO();
47+
/// Does *not* include the type-body hashes of the top level types.
48+
/// Just the `SourceFile` hashes.
49+
/// Used for incremental imports.
50+
Fingerprint InterfaceHashExcludingTypeMembers = Fingerprint::ZERO();
51+
llvm::sys::TimePoint<> LastModified = {};
52+
uint64_t FileSize = 0;
53+
54+
// Populate the from 'SF' member if exist. 'SF' will be cleared.
55+
void populateWithSourceFileIfNeeded();
56+
57+
public:
58+
BasicSourceFileInfo(StringRef FilePath,
59+
Fingerprint InterfaceHashIncludingTypeMembers,
60+
Fingerprint InterfaceHashExcludingTypeMembers,
61+
llvm::sys::TimePoint<> LastModified, uint64_t FileSize)
62+
: FilePath(FilePath),
63+
InterfaceHashIncludingTypeMembers(InterfaceHashIncludingTypeMembers),
64+
InterfaceHashExcludingTypeMembers(InterfaceHashExcludingTypeMembers),
65+
LastModified(LastModified), FileSize(FileSize) {}
66+
67+
/// Construct with a `SourceFile`. `getInterfaceHashIncludingTypeMembers()`,
68+
/// `getInterfaceHashExcludingTypeMembers()`, `getLastModified()` and
69+
/// `getFileSize()` are laizily populated when accessed.
70+
BasicSourceFileInfo(const SourceFile *SF);
71+
72+
bool isFromSourceFile() const;
73+
74+
StringRef getFilePath() const { return FilePath; }
75+
76+
Fingerprint getInterfaceHashIncludingTypeMembers() const {
77+
const_cast<BasicSourceFileInfo *>(this)->populateWithSourceFileIfNeeded();
78+
return InterfaceHashIncludingTypeMembers;
79+
}
80+
81+
Fingerprint getInterfaceHashExcludingTypeMembers() const {
82+
const_cast<BasicSourceFileInfo *>(this)->populateWithSourceFileIfNeeded();
83+
return InterfaceHashExcludingTypeMembers;
84+
}
85+
86+
llvm::sys::TimePoint<> getLastModified() const {
87+
const_cast<BasicSourceFileInfo *>(this)->populateWithSourceFileIfNeeded();
88+
return LastModified;
89+
}
90+
91+
uint64_t getFileSize() const {
92+
const_cast<BasicSourceFileInfo *>(this)->populateWithSourceFileIfNeeded();
93+
return FileSize;
94+
}
95+
};
96+
97+
} // namespace swift
98+
99+
#endif // SWIFT_BASIC_BASIC_SOURCE_INFO_H
100+

include/swift/IDE/Utils.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "swift/IDE/SourceEntityWalker.h"
2323
#include "swift/Parse/Token.h"
2424
#include "llvm/ADT/StringRef.h"
25+
#include "llvm/Support/VirtualFileSystem.h"
2526
#include <memory>
2627
#include <string>
2728
#include <functional>

include/swift/Parse/Parser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1582,7 +1582,7 @@ class Parser {
15821582
DeclNameRef parseDeclNameRef(DeclNameLoc &loc, const Diagnostic &diag,
15831583
DeclNameOptions flags);
15841584

1585-
Expr *parseExprIdentifier();
1585+
ParserResult<Expr> parseExprIdentifier();
15861586
Expr *parseExprEditorPlaceholder(Token PlaceholderTok,
15871587
Identifier PlaceholderId);
15881588

0 commit comments

Comments
 (0)