Skip to content

Commit 32ec462

Browse files
committed
[clang][Interp][NFC] Handle body-less functions like implicit ones
They don't have any source to look up locations in.
1 parent 45f3eea commit 32ec462

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clang/lib/AST/Interp/InterpFrame.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ Pointer InterpFrame::getParamPointer(unsigned Off) {
228228
SourceInfo InterpFrame::getSource(CodePtr PC) const {
229229
// Implicitly created functions don't have any code we could point at,
230230
// so return the call site.
231-
if (Func && Func->getDecl()->isImplicit() && Caller)
231+
if (Func && (!Func->hasBody() || Func->getDecl()->isImplicit()) && Caller)
232232
return Caller->getSource(RetPC);
233233

234234
return S.getSource(Func, PC);
@@ -243,7 +243,7 @@ SourceLocation InterpFrame::getLocation(CodePtr PC) const {
243243
}
244244

245245
SourceRange InterpFrame::getRange(CodePtr PC) const {
246-
if (Func && Func->getDecl()->isImplicit() && Caller)
246+
if (Func && (!Func->hasBody() || Func->getDecl()->isImplicit()) && Caller)
247247
return Caller->getRange(RetPC);
248248

249249
return S.getRange(Func, PC);

0 commit comments

Comments
 (0)