mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Function builders] Minor fixes for "load" expr generation
This commit is contained in:
@@ -240,7 +240,7 @@ protected:
|
||||
if (!childVar)
|
||||
return;
|
||||
|
||||
expressions.push_back(buildVarRef(childVar, braceStmt->getEndLoc()));
|
||||
expressions.push_back(buildVarRef(childVar, childVar->getLoc()));
|
||||
};
|
||||
|
||||
for (const auto &node : braceStmt->getElements()) {
|
||||
@@ -713,6 +713,12 @@ private:
|
||||
temporaryVar, DeclNameLoc(implicitLoc), /*implicit=*/true);
|
||||
declRef->setType(LValueType::get(temporaryVar->getType()));
|
||||
|
||||
// Load the right-hand side if needed.
|
||||
if (finalCapturedExpr->getType()->is<LValueType>()) {
|
||||
auto &cs = solution.getConstraintSystem();
|
||||
finalCapturedExpr = cs.addImplicitLoadExpr(finalCapturedExpr);
|
||||
}
|
||||
|
||||
auto assign = new (ctx) AssignExpr(
|
||||
declRef, implicitLoc, finalCapturedExpr, /*implicit=*/true);
|
||||
assign->setType(TupleType::getEmpty(ctx));
|
||||
|
||||
@@ -13,7 +13,7 @@ struct Summer {
|
||||
// CHECK-LABEL: sil_coverage_map {{.*}} "$s24coverage_functon_builder5test0SiyF"
|
||||
@Summer
|
||||
func test0() -> Int {
|
||||
// CHECK: [[@LINE-1]]:21 -> [[@LINE+2]]:5 : 0
|
||||
// CHECK: [[@LINE-1]]:21 -> [[@LINE+3]]:2 : 0
|
||||
18
|
||||
12
|
||||
}
|
||||
@@ -21,7 +21,7 @@ func test0() -> Int {
|
||||
// CHECK-LABEL: sil_coverage_map {{.*}} "$s24coverage_functon_builder5test1SiyF"
|
||||
@Summer
|
||||
func test1() -> Int {
|
||||
// CHECK: [[@LINE-1]]:21 -> [[@LINE+6]]:4 : 0
|
||||
// CHECK: [[@LINE-1]]:21 -> [[@LINE+7]]:2 : 0
|
||||
18
|
||||
12
|
||||
if 7 < 23 {
|
||||
|
||||
Reference in New Issue
Block a user