mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Type annotations for instruction operands are omitted, e.g. ``` %3 = struct $S(%1, %2) ``` Operand types are redundant anyway and were only used for sanity checking in the SIL parser. But: operand types _are_ printed if the definition of the operand value was not printed yet. This happens: * if the block with the definition appears after the block where the operand's instruction is located * if a block or instruction is printed in isolation, e.g. in a debugger The old behavior can be restored with `-Xllvm -sil-print-types`. This option is added to many existing test files which check for operand types in their check-lines.
23 lines
1.1 KiB
Swift
23 lines
1.1 KiB
Swift
// RUN: %target-swift-frontend %s -parse-as-library -emit-ir -g -o - \
|
|
// RUN: -module-name main | %FileCheck %s
|
|
// RUN: %target-swift-frontend %s -parse-as-library -Xllvm -sil-print-types -emit-sil \
|
|
// RUN: -Xllvm -sil-print-types -Xllvm -sil-print-debuginfo -o - \
|
|
// RUN: -module-name main | %FileCheck %s --check-prefix=SIL
|
|
|
|
// The variable i and the argument i must be in different scopes or the debugger
|
|
// doesn't know which one shadows the other.
|
|
public func f(i: Int) {
|
|
let i = [i, i]
|
|
print(i)
|
|
}
|
|
|
|
// CHECK: ![[S1:[0-9]+]] = distinct !DISubprogram(name: "f",
|
|
// CHECK: !DILocalVariable(name: "i", arg: 1, scope: ![[S1]],
|
|
// CHECK: !DILocalVariable(name: "i", scope: ![[S3:[0-9]+]],
|
|
// CHECK: ![[S3]] = distinct !DILexicalBlock(scope: ![[S1]],
|
|
// SIL: sil_scope [[S1:[0-9]+]] { {{.*}} parent @$s4main1f1iySi_tF
|
|
// SIL: sil_scope [[S2:[0-9]+]] { {{.*}} parent [[S1]] }
|
|
// SIL: sil_scope [[S3:[0-9]+]] { {{.*}} parent [[S1]] }
|
|
// SIL: debug_value %0 : $Int, let, name "i", argno 1,{{.*}}, scope [[S1]]
|
|
// SIL: debug_value {{.*}} : $Array<Int>, let, name "i", {{.*}}, scope [[S3]]
|