mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Use $binding$generator as debug name for generators instead of $generator.
rdar://problem/17860627 Swift SVN r20788
This commit is contained in:
@@ -426,9 +426,13 @@ public:
|
||||
if (!getGenerator) return nullptr;
|
||||
|
||||
// Create a local variable to capture the generator.
|
||||
std::string name;
|
||||
if (auto np = dyn_cast_or_null<NamedPattern>(S->getPattern()))
|
||||
name = "$"+np->getBoundName().str().str();
|
||||
name += "$generator";
|
||||
generator = new (TC.Context)
|
||||
VarDecl(/*static*/ false, /*IsLet*/ false, S->getInLoc(),
|
||||
TC.Context.getIdentifier("$generator"), generatorTy, DC);
|
||||
TC.Context.getIdentifier(name), generatorTy, DC);
|
||||
generator->setImplicit();
|
||||
|
||||
// Create a pattern binding to initialize the generator.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// RUN: %swift -target x86_64-apple-macosx10.9 %s -emit-ir -g -o %t.ll
|
||||
// RUN cat %t.ll | FileCheck %s
|
||||
// RUN: cat %t.ll | FileCheck %s
|
||||
var puzzleInput = "great minds think alike"
|
||||
var puzzleOutput = ""
|
||||
// CHECK: [ DW_TAG_auto_variable ] [$generator] [line [[@LINE+2]]]
|
||||
// CHECK: [ DW_TAG_auto_variable ] [$letter$generator] [line [[@LINE+2]]]
|
||||
// CHECK: [ DW_TAG_auto_variable ] [letter] [line [[@LINE+1]]]
|
||||
for letter in puzzleInput {
|
||||
switch letter {
|
||||
@@ -16,7 +16,7 @@ println(puzzleOutput)
|
||||
|
||||
|
||||
func count() {
|
||||
// CHECK: [ DW_TAG_auto_variable ] [$generator] [line [[@LINE+2]]]
|
||||
// CHECK: [ DW_TAG_auto_variable ] [$i$generator] [line [[@LINE+2]]]
|
||||
// CHECK: [ DW_TAG_auto_variable ] [i] [line [[@LINE+1]]]
|
||||
for i in 0...100 {
|
||||
println(i)
|
||||
|
||||
Reference in New Issue
Block a user