Skip to content

Commit f68ebcf

Browse files
Merge pull request #3037 from swiftwasm/katei/merge-main-2021-04-27
Merge main 2021-04-27
2 parents d0c0527 + 894faa6 commit f68ebcf

File tree

58 files changed

+1129
-923
lines changed

Some content is hidden

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

58 files changed

+1129
-923
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4253,17 +4253,17 @@ WARNING(no_throw_in_do_with_catch,none,
42534253
//------------------------------------------------------------------------------
42544254
// MARK: Concurrency
42554255
//------------------------------------------------------------------------------
4256-
ERROR(async_call_without_await,none,
4257-
"call is 'async' but is not marked with 'await'", ())
4258-
ERROR(async_call_without_await_in_autoclosure,none,
4259-
"call is 'async' in an autoclosure argument that is not marked with 'await'", ())
4260-
ERROR(async_call_without_await_in_async_let,none,
4261-
"call is 'async' in an 'async let' initializer that is not marked "
4262-
"with 'await'", ())
4263-
ERROR(async_prop_access_without_await,none,
4264-
"property access is 'async' but is not marked with 'await'", ())
4265-
ERROR(async_subscript_access_without_await,none,
4266-
"subscript access is 'async' but is not marked with 'await'", ())
4256+
ERROR(async_expr_without_await,none,
4257+
"expression is 'async' but is not marked with 'await'", ())
4258+
4259+
NOTE(async_access_without_await,none,
4260+
"%select{call|property access|subscript access|}0 is 'async'", (unsigned))
4261+
4262+
NOTE(async_call_without_await_in_autoclosure,none,
4263+
"call is 'async' in an autoclosure argument", ())
4264+
NOTE(async_call_without_await_in_async_let,none,
4265+
"call is 'async' in an 'async let' initializer", ())
4266+
42674267
WARNING(no_async_in_await,none,
42684268
"no 'async' operations occur within 'await' expression", ())
42694269
ERROR(async_call_in_illegal_context,none,
@@ -4310,8 +4310,8 @@ ERROR(async_let_not_initialized,none,
43104310
"'async let' binding requires an initializer expression", ())
43114311
ERROR(async_let_no_variables,none,
43124312
"'async let' requires at least one named variable", ())
4313-
ERROR(async_let_without_await,none,
4314-
"reference to async let %0 is not marked with 'await'", (DeclName))
4313+
NOTE(async_let_without_await,none,
4314+
"reference to async let %0 is 'async'", (DeclName))
43154315
ERROR(async_let_in_illegal_context,none,
43164316
"async let %0 cannot be referenced in "
43174317
"%select{<<ERROR>>|a default argument|a property wrapper initializer|a property initializer|a global variable initializer|an enum case raw value|a catch pattern|a catch guard expression|a defer body}1",

include/swift/AST/Expr.h

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4444,16 +4444,16 @@ class ApplyExpr : public Expr {
44444444
/// The function being called.
44454445
Expr *Fn;
44464446

4447-
/// The argument being passed to it, and whether it's a 'super' argument.
4448-
llvm::PointerIntPair<Expr *, 1, bool> ArgAndIsSuper;
4447+
/// The argument being passed to it.
4448+
Expr *Arg;
44494449

44504450
/// Returns true if \c e could be used as the call's argument. For most \c ApplyExpr
44514451
/// subclasses, this means it is a \c ParenExpr or \c TupleExpr.
44524452
bool validateArg(Expr *e) const;
44534453

44544454
protected:
44554455
ApplyExpr(ExprKind Kind, Expr *Fn, Expr *Arg, bool Implicit, Type Ty = Type())
4456-
: Expr(Kind, Implicit, Ty), Fn(Fn), ArgAndIsSuper(Arg, false) {
4456+
: Expr(Kind, Implicit, Ty), Fn(Fn), Arg(Arg) {
44574457
assert(classof((Expr*)this) && "ApplyExpr::classof out of date");
44584458
assert(validateArg(Arg) && "Arg is not a permitted expr kind");
44594459
Bits.ApplyExpr.ThrowsIsSet = false;
@@ -4466,15 +4466,10 @@ class ApplyExpr : public Expr {
44664466
void setFn(Expr *e) { Fn = e; }
44674467
Expr *getSemanticFn() const { return Fn->getSemanticsProvidingExpr(); }
44684468

4469-
Expr *getArg() const { return ArgAndIsSuper.getPointer(); }
4469+
Expr *getArg() const { return Arg; }
44704470
void setArg(Expr *e) {
44714471
assert(validateArg(e) && "Arg is not a permitted expr kind");
4472-
ArgAndIsSuper = {e, ArgAndIsSuper.getInt()};
4473-
}
4474-
4475-
bool isSuper() const { return ArgAndIsSuper.getInt(); }
4476-
void setIsSuper(bool super) {
4477-
ArgAndIsSuper = {ArgAndIsSuper.getPointer(), super};
4472+
Arg = e;
44784473
}
44794474

44804475
/// Has the type-checker set the 'throws' bit yet?

include/swift/SILOptimizer/Differentiation/Thunk.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ getOrCreateSubsetParametersThunkForLinearMap(
121121
SILOptFunctionBuilder &fb, SILFunction *assocFn,
122122
CanSILFunctionType origFnType, CanSILFunctionType linearMapType,
123123
CanSILFunctionType targetType, AutoDiffDerivativeFunctionKind kind,
124-
AutoDiffConfig desiredConfig, AutoDiffConfig actualConfig,
124+
const AutoDiffConfig &desiredConfig, const AutoDiffConfig &actualConfig,
125125
ADContext &adContext);
126126

127127
} // end namespace autodiff

include/swift/SILOptimizer/Utils/DebugOptUtils.h

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,43 @@ inline void deleteAllDebugUses(SILInstruction *inst,
4343
}
4444
}
4545

46+
/// Erases the instruction \p I from it's parent block and deletes it, including
47+
/// all debug instructions which use \p I.
48+
/// Precondition: The instruction may only have debug instructions as uses.
49+
/// If the iterator \p InstIter references any deleted instruction, it is
50+
/// incremented.
51+
///
52+
/// \p callbacks InstModCallback to use.
53+
///
54+
/// Returns an iterator to the next non-deleted instruction after \p I.
55+
inline SILBasicBlock::iterator
56+
eraseFromParentWithDebugInsts(SILInstruction *inst,
57+
InstModCallbacks callbacks = InstModCallbacks()) {
58+
auto nextII = std::next(inst->getIterator());
59+
60+
auto results = inst->getResults();
61+
bool foundAny;
62+
do {
63+
foundAny = false;
64+
for (auto result : results) {
65+
while (!result->use_empty()) {
66+
foundAny = true;
67+
auto *user = result->use_begin()->getUser();
68+
assert(user->isDebugInstruction());
69+
if (nextII == user->getIterator())
70+
++nextII;
71+
callbacks.deleteInst(user);
72+
}
73+
}
74+
} while (foundAny);
75+
76+
// Just matching what eraseFromParentWithDebugInsts is today.
77+
if (nextII == inst->getIterator())
78+
++nextII;
79+
callbacks.deleteInst(inst, false /*do not notify*/);
80+
return nextII;
81+
}
82+
4683
} // namespace swift
4784

4885
#endif

0 commit comments

Comments
 (0)