@@ -207,31 +207,40 @@ Pointer InterpFrame::getParamPointer(unsigned Off) {
207207 return Pointer (B);
208208}
209209
210+ static bool funcHasUsableBody (const Function *F) {
211+ assert (F);
212+
213+ if (F->isConstructor () || F->isDestructor ())
214+ return true ;
215+
216+ return !F->getDecl ()->isImplicit ();
217+ }
218+
210219SourceInfo InterpFrame::getSource (CodePtr PC) const {
211220 // Implicitly created functions don't have any code we could point at,
212221 // so return the call site.
213- if (Func && (!Func-> hasBody () || Func-> getDecl ()-> isImplicit () ) && Caller)
222+ if (Func && ! funcHasUsableBody ( Func) && Caller)
214223 return Caller->getSource (RetPC);
215224
216225 return S.getSource (Func, PC);
217226}
218227
219228const Expr *InterpFrame::getExpr (CodePtr PC) const {
220- if (Func && (!Func-> hasBody () || Func-> getDecl ()-> isImplicit () ) && Caller)
221- return Caller->getExpr (RetPC );
229+ if (Func && ! funcHasUsableBody ( Func) && Caller)
230+ return Caller->getExpr (PC );
222231
223232 return S.getExpr (Func, PC);
224233}
225234
226235SourceLocation InterpFrame::getLocation (CodePtr PC) const {
227- if (Func && (!Func-> hasBody () || Func-> getDecl ()-> isImplicit () ) && Caller)
236+ if (Func && ! funcHasUsableBody ( Func) && Caller)
228237 return Caller->getLocation (RetPC);
229238
230239 return S.getLocation (Func, PC);
231240}
232241
233242SourceRange InterpFrame::getRange (CodePtr PC) const {
234- if (Func && (!Func-> hasBody () || Func-> getDecl ()-> isImplicit () ) && Caller)
243+ if (Func && ! funcHasUsableBody ( Func) && Caller)
235244 return Caller->getRange (RetPC);
236245
237246 return S.getRange (Func, PC);
0 commit comments