@@ -1726,27 +1726,31 @@ struct SILDebugVariable {
17261726 StringRef Name;
17271727 unsigned ArgNo : 16 ;
17281728 unsigned Constant : 1 ;
1729+ unsigned Implicit : 1 ;
17291730 Optional<SILType> Type;
17301731 Optional<SILLocation> Loc;
17311732 const SILDebugScope *Scope;
17321733 SILDebugInfoExpression DIExpr;
17331734
1734- SILDebugVariable () : ArgNo(0 ), Constant(false ), Scope(nullptr ) {}
1735+ SILDebugVariable ()
1736+ : ArgNo(0 ), Constant(false ), Implicit(false ), Scope(nullptr ) {}
17351737 SILDebugVariable (bool Constant, uint16_t ArgNo)
1736- : ArgNo(ArgNo), Constant(Constant), Scope(nullptr ) {}
1738+ : ArgNo(ArgNo), Constant(Constant), Implicit( false ), Scope(nullptr ) {}
17371739 SILDebugVariable (StringRef Name, bool Constant, unsigned ArgNo,
1738- Optional<SILType> AuxType = {},
1740+ bool IsImplicit = false , Optional<SILType> AuxType = {},
17391741 Optional<SILLocation> DeclLoc = {},
17401742 const SILDebugScope *DeclScope = nullptr ,
17411743 llvm::ArrayRef<SILDIExprElement> ExprElements = {})
1742- : Name(Name), ArgNo(ArgNo), Constant(Constant), Type(AuxType),
1743- Loc (DeclLoc), Scope(DeclScope), DIExpr(ExprElements) {}
1744+ : Name(Name), ArgNo(ArgNo), Constant(Constant), Implicit(IsImplicit),
1745+ Type (AuxType), Loc(DeclLoc), Scope(DeclScope), DIExpr(ExprElements) {}
1746+
17441747 // We're not comparing DIExpr here because strictly speaking,
17451748 // DIExpr is not part of the debug variable. We simply piggyback
17461749 // it in this class so that's it's easier to carry DIExpr around.
17471750 bool operator ==(const SILDebugVariable &V) {
17481751 return ArgNo == V.ArgNo && Constant == V.Constant && Name == V.Name &&
1749- Type == V.Type && Loc == V.Loc && Scope == V.Scope ;
1752+ Implicit == V.Implicit && Type == V.Type && Loc == V.Loc &&
1753+ Scope == V.Scope ;
17501754 }
17511755};
17521756
@@ -1761,10 +1765,12 @@ class TailAllocatedDebugVariable {
17611765 int_type HasValue : 1 ;
17621766 // / True if this is a let-binding.
17631767 int_type Constant : 1 ;
1768+ // / True if this variable is created by compiler
1769+ int_type Implicit : 1 ;
17641770 // / When this is nonzero there is a tail-allocated string storing
17651771 // / variable name present. This typically only happens for
17661772 // / instructions that were created from parsing SIL assembler.
1767- int_type NameLength : 14 ;
1773+ int_type NameLength : 13 ;
17681774 // / The source function argument position from left to right
17691775 // / starting with 1 or 0 if this is a local variable.
17701776 int_type ArgNo : 16 ;
@@ -1786,6 +1792,9 @@ class TailAllocatedDebugVariable {
17861792 StringRef getName (const char *buf) const ;
17871793 bool isLet () const { return Bits.Data .Constant ; }
17881794
1795+ bool isImplicit () const { return Bits.Data .Implicit ; }
1796+ void setImplicit (bool V = true ) { Bits.Data .Implicit = V; }
1797+
17891798 Optional<SILDebugVariable>
17901799 get (VarDecl *VD, const char *buf, Optional<SILType> AuxVarType = {},
17911800 Optional<SILLocation> DeclLoc = {},
@@ -1796,11 +1805,11 @@ class TailAllocatedDebugVariable {
17961805
17971806 if (VD)
17981807 return SILDebugVariable (VD->getName ().empty () ? " " : VD->getName ().str (),
1799- VD->isLet (), getArgNo (), AuxVarType, DeclLoc,
1800- DeclScope, DIExprElements);
1801- else
1802- return SILDebugVariable (getName (buf), isLet (), getArgNo (), AuxVarType,
1808+ VD->isLet (), getArgNo (), isImplicit (), AuxVarType,
18031809 DeclLoc, DeclScope, DIExprElements);
1810+ else
1811+ return SILDebugVariable (getName (buf), isLet (), getArgNo (), isImplicit (),
1812+ AuxVarType, DeclLoc, DeclScope, DIExprElements);
18041813 }
18051814};
18061815static_assert (sizeof (TailAllocatedDebugVariable) == 4 ,
0 commit comments