@@ -121,19 +121,19 @@ void InterpFrame::destroy(unsigned Idx) {
121121}
122122
123123template <typename T>
124- static void print (llvm::raw_ostream &OS, const T &V, ASTContext &ASTCtx ,
124+ static void print (llvm::raw_ostream &OS, const T &V, const Context &Ctx ,
125125 QualType Ty) {
126126 if constexpr (std::is_same_v<Pointer, T>) {
127127 if (Ty->isPointerOrReferenceType ())
128- V.toAPValue (ASTCtx) .printPretty (OS, ASTCtx , Ty);
128+ V.toAPValue (Ctx. getASTContext ()) .printPretty (OS, Ctx. getASTContext () , Ty);
129129 else {
130- if (std::optional<APValue> RValue = V.toRValue (ASTCtx , Ty))
131- RValue->printPretty (OS, ASTCtx , Ty);
130+ if (std::optional<APValue> RValue = V.toRValue (Ctx , Ty))
131+ RValue->printPretty (OS, Ctx. getASTContext () , Ty);
132132 else
133133 OS << " ..." ;
134134 }
135135 } else {
136- V.toAPValue (ASTCtx) .printPretty (OS, ASTCtx , Ty);
136+ V.toAPValue (Ctx. getASTContext ()) .printPretty (OS, Ctx. getASTContext () , Ty);
137137 }
138138}
139139
@@ -159,9 +159,10 @@ void InterpFrame::describe(llvm::raw_ostream &OS) const {
159159 if (shouldSkipInBacktrace (Func))
160160 return ;
161161
162+ const ASTContext &ASTCtx = S.getASTContext ();
162163 const Expr *CallExpr = Caller->getExpr (getRetPC ());
163164 const FunctionDecl *F = getCallee ();
164- auto PrintingPolicy = S. getASTContext () .getPrintingPolicy ();
165+ auto PrintingPolicy = ASTCtx .getPrintingPolicy ();
165166 PrintingPolicy.SuppressLambdaBody = true ;
166167
167168 bool IsMemberCall = false ;
@@ -180,39 +181,38 @@ void InterpFrame::describe(llvm::raw_ostream &OS) const {
180181 if (Object->getType ()->isPointerType ())
181182 OS << " ->" ;
182183 else
183- OS << " . " ;
184+ OS << ' . ' ;
184185 } else if (const auto *OCE =
185186 dyn_cast_if_present<CXXOperatorCallExpr>(CallExpr)) {
186187 OCE->getArg (0 )->printPretty (OS, /* Helper=*/ nullptr ,
187188 PrintingPolicy,
188189 /* Indentation=*/ 0 );
189- OS << " . " ;
190+ OS << ' . ' ;
190191 } else if (const auto *M = dyn_cast<CXXMethodDecl>(F)) {
191- print (OS, getThis (), S.getASTContext (),
192- S. getASTContext () .getLValueReferenceType (
193- S. getASTContext () .getCanonicalTagType (M->getParent ())));
194- OS << " . " ;
192+ print (OS, getThis (), S.getContext (),
193+ ASTCtx .getLValueReferenceType (
194+ ASTCtx .getCanonicalTagType (M->getParent ())));
195+ OS << ' . ' ;
195196 }
196197 }
197198
198- F->getNameForDiagnostic (OS, PrintingPolicy,
199- /* Qualified=*/ false );
199+ F->getNameForDiagnostic (OS, PrintingPolicy, /* Qualified=*/ false );
200200 OS << ' (' ;
201201 unsigned Off = 0 ;
202-
202+ unsigned ParamIndex = 0 ;
203203 Off += Func->hasRVO () ? primSize (PT_Ptr) : 0 ;
204204 Off += Func->hasThisPointer () ? primSize (PT_Ptr) : 0 ;
205205 llvm::ListSeparator Comma;
206206 for (const ParmVarDecl *Param :
207207 F->parameters ().slice (ExplicitInstanceParam)) {
208208 OS << Comma;
209- QualType Ty = Param-> getType () ;
210- PrimType PrimTy = S. Ctx . classify (Ty). value_or (PT_Ptr);
211-
212- TYPE_SWITCH (PrimTy, print (OS, stackRef<T>(Off), S. getASTContext (), Ty ));
213- Off += align ( primSize (PrimTy)) ;
209+ PrimType PrimT = Func-> getParamDescriptor (ParamIndex). T ;
210+ TYPE_SWITCH (PrimT,
211+ print (OS, stackRef<T>(Off), S. getContext (), Param-> getType ()));
212+ Off += align ( primSize (PrimT ));
213+ ++ParamIndex ;
214214 }
215- OS << " ) " ;
215+ OS << ' ) ' ;
216216}
217217
218218SourceRange InterpFrame::getCallRange () const {
0 commit comments