mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Fix handling of implicit locations for variables
This commit is contained in:
@@ -176,7 +176,7 @@ SILGenFunction::getSILDebugLocation(SILBuilder &B, SILLocation Loc,
|
||||
const SILDebugScope *Scope = B.getCurrentDebugScope();
|
||||
if (!Scope)
|
||||
Scope = F.getDebugScope();
|
||||
if (auto *SILScope = getScopeOrNull(Loc)) {
|
||||
if (auto *SILScope = getScopeOrNull(Loc, ForMetaInstruction)) {
|
||||
Scope = SILScope;
|
||||
// Metainstructions such as a debug_value may break the flow of scopes and
|
||||
// should not change the state of the builder.
|
||||
@@ -187,14 +187,16 @@ SILGenFunction::getSILDebugLocation(SILBuilder &B, SILLocation Loc,
|
||||
return SILDebugLocation(overriddenLoc, Scope);
|
||||
}
|
||||
|
||||
const SILDebugScope *SILGenFunction::getScopeOrNull(SILLocation Loc) {
|
||||
if (Loc.getKind() == SILLocation::CleanupKind ||
|
||||
Loc.getKind() == SILLocation::ImplicitReturnKind ||
|
||||
// The source locations produced by the ResultBuilder transformation are
|
||||
// all over the place.
|
||||
Loc.isImplicit() ||
|
||||
Loc.isAutoGenerated())
|
||||
return nullptr;
|
||||
const SILDebugScope *SILGenFunction::getScopeOrNull(SILLocation Loc,
|
||||
bool ForMetaInstruction) {
|
||||
if (!ForMetaInstruction) {
|
||||
if (Loc.getKind() == SILLocation::CleanupKind ||
|
||||
Loc.getKind() == SILLocation::ImplicitReturnKind ||
|
||||
// The source locations produced by the ResultBuilder transformation are
|
||||
// all over the place.
|
||||
Loc.isImplicit() || Loc.isAutoGenerated())
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SourceLoc SLoc = Loc.getSourceLoc();//ForDebugging();
|
||||
if (!SF || LastSourceLoc == SLoc)
|
||||
|
||||
Reference in New Issue
Block a user