Files
swift-mirror/test/SILOptimizer/constantprop-wrongscope.swift
Adrian Prantl 4174e2136f Remove the redundant lexical scope for function-body brace statements.
Before this patch every Swift function would contain a top-level
DW_TAG_lexical_scope that didn't provide any useful information, used extra
space in the debug info and prevented local variables from showing up in virtual
async backtraces.
2021-02-26 13:53:30 -08:00

24 lines
933 B
Swift

// RUN: %empty-directory(%t)
// RUN: %build-clang-importer-objc-overlays
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -I \
// RUN: %S/../ClangImporter/Inputs/custom-modules -emit-sil -o /dev/null \
// RUN: -primary-file %s -Xllvm -sil-print-debuginfo -module-name patatino \
// RUN: -Onone -Xllvm -sil-print-after=diagnostic-constant-propagation \
// RUN: 2>&1 | %FileCheck %s
// REQUIRES: objc_interop
// REQUIRES: OS=macosx
// Make sure that the destroy_addr instruction has the same scope of the
// instructions surrounding it.
// CHECK: destroy_addr %7 : $*Any, loc {{.*}}:22:19, scope 1
// CHECK: dealloc_stack %12 : $*Optional<Any>, loc {{.*}}:22:23, scope 1
// CHECK: dealloc_stack %7 : $*Any, loc {{.*}}:22:23, scope 1
// CHECK: dealloc_stack %6 : $*A, loc {{.*}}:22:7, scope 1
import Foundation
func indexedSubscripting(b b: B, idx: Int, a: A) {
var a2 = b[idx] as! A
}