@@ -279,16 +279,8 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
279279 DebugTypeInfo DebugType,
280280 bool IsLocalToUnit,
281281 std::optional<SILLocation> Loc);
282-
283- void emitArtificialVariable (IRGenFunction &IGF, llvm::Value *Metadata,
284- StringRef Name, StringRef Identifier);
285-
286282 void emitTypeMetadata (IRGenFunction &IGF, llvm::Value *Metadata,
287- GenericTypeParamType *Type);
288-
289- void emitWitnessTable (IRGenFunction &IGF, llvm::Value *Metadata,
290- StringRef Name, ProtocolDecl *protocol);
291-
283+ unsigned Depth, unsigned Index, StringRef Name);
292284 void emitPackCountParameter (IRGenFunction &IGF, llvm::Value *Metadata,
293285 SILDebugVariable VarInfo);
294286
@@ -3912,10 +3904,9 @@ void IRGenDebugInfoImpl::emitGlobalVariableDeclaration(
39123904 Var->addDebugInfo (GV);
39133905}
39143906
3915- void IRGenDebugInfoImpl::emitArtificialVariable (IRGenFunction &IGF,
3916- llvm::Value *Metadata,
3917- StringRef Name,
3918- StringRef Identifier) {
3907+ void IRGenDebugInfoImpl::emitTypeMetadata (IRGenFunction &IGF,
3908+ llvm::Value *Metadata, unsigned Depth,
3909+ unsigned Index, StringRef Name) {
39193910 if (Opts.DebugInfoLevel <= IRGenDebugInfoLevel::LineTables)
39203911 return ;
39213912
@@ -3924,44 +3915,23 @@ void IRGenDebugInfoImpl::emitArtificialVariable(IRGenFunction &IGF,
39243915 if (!DS || DS->getInlinedFunction ()->isTransparent ())
39253916 return ;
39263917
3927- uint64_t PtrWidthInBits =
3928- CI.getTargetInfo ().getPointerWidth (clang::LangAS::Default);
3918+ llvm::SmallString<8 > Buf;
3919+ static const char *Tau = SWIFT_UTF8 (" \u03C4 " );
3920+ llvm::raw_svector_ostream OS (Buf);
3921+ OS << ' $' << Tau << ' _' << Depth << ' _' << Index;
3922+ uint64_t PtrWidthInBits = CI.getTargetInfo ().getPointerWidth (clang::LangAS::Default);
39293923 assert (PtrWidthInBits % 8 == 0 );
39303924 auto DbgTy = DebugTypeInfo::getTypeMetadata (
39313925 getMetadataType (Name)->getDeclaredInterfaceType ().getPointer (),
39323926 Size (PtrWidthInBits / 8 ),
39333927 Alignment (CI.getTargetInfo ().getPointerAlign (clang::LangAS::Default)));
3934- emitVariableDeclaration (
3935- IGF.Builder , Metadata, DbgTy, IGF.getDebugScope (), {},
3936- {Identifier, 0 , false }, // swift.type is already a pointer type,
3937- // having a shadow copy doesn't add another
3938- // layer of indirection.
3939- IGF.isAsync () ? CoroDirectValue : DirectValue, ArtificialValue);
3940- }
3941-
3942- void IRGenDebugInfoImpl::emitTypeMetadata (IRGenFunction &IGF,
3943- llvm::Value *Metadata,
3944- GenericTypeParamType *Type) {
3945- llvm::SmallString<8 > Buf;
3946- llvm::raw_svector_ostream OS (Buf);
3947- OS << " $" << Type->getCanonicalName ().str ();
3948- auto Name = Type->getName ().str ();
3949-
3950- emitArtificialVariable (IGF, Metadata, Name, OS.str ());
3951- }
3952-
3953- void IRGenDebugInfoImpl::emitWitnessTable (IRGenFunction &IGF,
3954- llvm::Value *Metadata, StringRef Name,
3955- ProtocolDecl *protocol) {
3956- llvm::SmallString<32 > Buf;
3957- llvm::raw_svector_ostream OS (Buf);
3958- DebugTypeInfo DbgTy (protocol->getDeclaredType ());
3959- auto MangledName = getMangledName (DbgTy).Canonical ;
3960- OS << " $WT" << Name << " $$" << MangledName;;
3961- // Make sure this ID lives long enough.
3962- auto Id = IGF.getSwiftModule ()->getASTContext ().getIdentifier (OS.str ());
3963-
3964- emitArtificialVariable (IGF, Metadata, Name, Id.str ());
3928+ emitVariableDeclaration (IGF.Builder , Metadata, DbgTy, IGF.getDebugScope (),
3929+ {}, {OS.str ().str (), 0 , false },
3930+ // swift.type is already a pointer type,
3931+ // having a shadow copy doesn't add another
3932+ // layer of indirection.
3933+ IGF.isAsync () ? CoroDirectValue : DirectValue,
3934+ ArtificialValue);
39653935}
39663936
39673937void IRGenDebugInfoImpl::emitPackCountParameter (IRGenFunction &IGF,
@@ -4100,15 +4070,10 @@ void IRGenDebugInfo::emitGlobalVariableDeclaration(
41004070}
41014071
41024072void IRGenDebugInfo::emitTypeMetadata (IRGenFunction &IGF, llvm::Value *Metadata,
4103- GenericTypeParamType *Type) {
4073+ unsigned Depth, unsigned Index,
4074+ StringRef Name) {
41044075 static_cast <IRGenDebugInfoImpl *>(this )->emitTypeMetadata (IGF, Metadata,
4105- Type);
4106- }
4107-
4108- void IRGenDebugInfo::emitWitnessTable (IRGenFunction &IGF, llvm::Value *Metadata,
4109- StringRef Name, ProtocolDecl *protocol) {
4110- static_cast <IRGenDebugInfoImpl *>(this )->emitWitnessTable (IGF, Metadata, Name,
4111- protocol);
4076+ Depth, Index, Name);
41124077}
41134078
41144079void IRGenDebugInfo::emitPackCountParameter (IRGenFunction &IGF,
0 commit comments