Skip to content

Commit 53a0676

Browse files
authored
Revert "[DebugInfo] Set the autogenerated bit to request recycled locations"
1 parent 3124f6a commit 53a0676

File tree

4 files changed

+8
-26
lines changed

4 files changed

+8
-26
lines changed

lib/IRGen/IRGenDebugInfo.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
125125
void finalize();
126126

127127
void setCurrentLoc(IRBuilder &Builder, const SILDebugScope *DS,
128-
SILLocation Loc);
128+
Optional<SILLocation> Loc = None);
129129
void clearLoc(IRBuilder &Builder);
130130
void pushLoc();
131131
void popLoc();
@@ -1555,7 +1555,7 @@ void IRGenDebugInfoImpl::finalize() {
15551555

15561556
void IRGenDebugInfoImpl::setCurrentLoc(IRBuilder &Builder,
15571557
const SILDebugScope *DS,
1558-
SILLocation Loc) {
1558+
Optional<SILLocation> Loc) {
15591559
assert(DS && "empty scope");
15601560
auto *Scope = getOrCreateScope(DS);
15611561
if (!Scope)
@@ -1565,7 +1565,7 @@ void IRGenDebugInfoImpl::setCurrentLoc(IRBuilder &Builder,
15651565
SILFunction *Fn = DS->getInlinedFunction();
15661566
if (Fn && Fn->isThunk()) {
15671567
L = SILLocation::getCompilerGeneratedDebugLoc();
1568-
} else if (DS == LastScope && Loc.isAutoGenerated()) {
1568+
} else if (DS == LastScope && Loc && Loc->isAutoGenerated()) {
15691569
// Reuse the last source location if we are still in the same
15701570
// scope to get a more contiguous line table.
15711571
L = LastDebugLoc;
@@ -1574,7 +1574,7 @@ void IRGenDebugInfoImpl::setCurrentLoc(IRBuilder &Builder,
15741574
L = getDebugLocation(Loc);
15751575
// Otherwise use a line 0 artificial location, but the file from the
15761576
// location.
1577-
if (Loc.isAutoGenerated()) {
1577+
if (Loc && Loc->isAutoGenerated()) {
15781578
L.Line = 0;
15791579
L.Column = 0;
15801580
}
@@ -2056,7 +2056,7 @@ void IRGenDebugInfo::finalize() {
20562056
}
20572057

20582058
void IRGenDebugInfo::setCurrentLoc(IRBuilder &Builder, const SILDebugScope *DS,
2059-
SILLocation Loc) {
2059+
Optional<SILLocation> Loc) {
20602060
static_cast<IRGenDebugInfoImpl *>(this)->setCurrentLoc(Builder, DS, Loc);
20612061
}
20622062

lib/IRGen/IRGenDebugInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class IRGenDebugInfo {
5757
/// Update the IRBuilder's current debug location to the location
5858
/// Loc and the lexical scope DS.
5959
void setCurrentLoc(IRBuilder &Builder, const SILDebugScope *DS,
60-
SILLocation Loc);
60+
Optional<SILLocation> Loc = None);
6161

6262
void clearLoc(IRBuilder &Builder);
6363

lib/IRGen/IRGenSIL.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1789,11 +1789,8 @@ void IRGenSILFunction::visitSILBasicBlock(SILBasicBlock *BB) {
17891789
auto Prev = --I.getIterator();
17901790
if (Prev != BB->end())
17911791
DS = Prev->getDebugScope();
1792-
1793-
// Use an artificial (line 0) location, to indicate we'd like to
1794-
// reuse the last debug loc.
1795-
IGM.DebugInfo->setCurrentLoc(
1796-
Builder, DS, RegularLocation::getAutoGeneratedLocation());
1792+
// Use an artificial (line 0) location.
1793+
IGM.DebugInfo->setCurrentLoc(Builder, DS);
17971794
}
17981795

17991796
if (isa<TermInst>(&I))

test/DebugInfo/returnlocation.swift

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -178,18 +178,3 @@ public func cleanup_simple_complex(_ a: NSString) -> Int64 {
178178
}
179179

180180
// ---------------------------------------------------------------------
181-
182-
// RUN: %FileCheck %s --check-prefix=CHECK_INIT < %t.ll
183-
// CHECK_INIT: define {{.*}}$S4main6Class1CACSgycfc
184-
public class Class1 {
185-
public required init?() {
186-
print("hello")
187-
// CHECK_INIT: call {{.*}}@"$Ss5print_9separator10terminatoryypd_S2StF"{{.*}}, !dbg [[printLoc:![0-9]+]]
188-
// CHECK_INIT-NEXT: call void @swift_bridgeObjectRelease{{.*}}, !dbg [[retnLoc:![0-9]+]]
189-
// CHECK_INIT: br label {{.*}}, !dbg [[retnLoc]]
190-
191-
// CHECK_INIT: [[printLoc]] = !DILocation(line: [[@LINE-5]]
192-
// CHECK_INIT: [[retnLoc]] = !DILocation(line: [[@LINE+1]]
193-
return nil
194-
}
195-
}

0 commit comments

Comments
 (0)