mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Debug info: No longer emit debug info for variables defined in implicit
patterns. <rdar://problem/19184859> Swift methods defining closures that capture self in the "in" clause end up with two "self" variables in the debug info Swift SVN r24461
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#include "swift/Basic/STLExtras.h"
|
||||
#include "swift/AST/ASTContext.h"
|
||||
#include "swift/AST/IRGenOptions.h"
|
||||
#include "swift/AST/Pattern.h"
|
||||
#include "swift/SIL/PrettyStackTrace.h"
|
||||
#include "swift/SIL/SILDebugScope.h"
|
||||
#include "swift/SIL/SILDeclRef.h"
|
||||
@@ -2940,7 +2941,9 @@ void IRGenSILFunction::visitAllocStackInst(swift::AllocStackInst *i) {
|
||||
auto addr = type.allocateStack(*this,
|
||||
i->getElementType(),
|
||||
dbgname);
|
||||
if (IGM.DebugInfo && Decl) {
|
||||
if (IGM.DebugInfo && Decl &&
|
||||
(!Decl->getParentPattern() ||
|
||||
!Decl->getParentPattern()->getPattern()->isImplicit())) {
|
||||
// Discard any inout or lvalue qualifiers. Since the object itself
|
||||
// is stored in the alloca, emitting it as a reference type would
|
||||
// be wrong.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// RUN: cat %t.ll | FileCheck %s
|
||||
var puzzleInput = "great minds think alike"
|
||||
var puzzleOutput = ""
|
||||
// CHECK: [ DW_TAG_auto_variable ] [$letter$generator] [line [[@LINE+2]]]
|
||||
// CHECK-NOT: [ 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 ] [$i$generator] [line [[@LINE+2]]]
|
||||
// CHECK-NOT: [ 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)
|
||||
|
||||
17
test/DebugInfo/unowned-capture.swift
Normal file
17
test/DebugInfo/unowned-capture.swift
Normal file
@@ -0,0 +1,17 @@
|
||||
// RUN: %swift -primary-file %s -emit-ir -g -o - | FileCheck %s
|
||||
class Foo
|
||||
{
|
||||
func DefinesClosure (a_string : String) -> () -> String
|
||||
{
|
||||
// Verify that we only emit the implicit argument,
|
||||
// and not the unowned local copy of self.
|
||||
//
|
||||
// CHECK-NOT: [ DW_TAG_auto_variable ] [self]
|
||||
// CHECK: [ DW_TAG_arg_variable ] [self]
|
||||
// CHECK-NOT: [ DW_TAG_auto_variable ] [self]
|
||||
return { [unowned self] in
|
||||
var tmp_string = a_string
|
||||
return tmp_string
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user