Use $binding$generator as debug name for generators instead of $generator.

rdar://problem/17860627

Swift SVN r20788
This commit is contained in:
Adrian Prantl
2014-07-30 23:35:52 +00:00
parent ad9097805d
commit acf904a518
2 changed files with 8 additions and 4 deletions

View File

@@ -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.

View File

@@ -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)