[clang] 32ec462 - [clang][Interp][NFC] Handle body-less functions like implicit ones
Timm Bäder via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 11 07:48:52 PST 2023
Author: Timm Bäder
Date: 2023-12-11T16:48:21+01:00
New Revision: 32ec462519accb92176fe87b1fc7566b02187e4b
URL: https://github.com/llvm/llvm-project/commit/32ec462519accb92176fe87b1fc7566b02187e4b
DIFF: https://github.com/llvm/llvm-project/commit/32ec462519accb92176fe87b1fc7566b02187e4b.diff
LOG: [clang][Interp][NFC] Handle body-less functions like implicit ones
They don't have any source to look up locations in.
Added:
Modified:
clang/lib/AST/Interp/InterpFrame.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/Interp/InterpFrame.cpp b/clang/lib/AST/Interp/InterpFrame.cpp
index b06923114c7a24..d460d7ea3710a8 100644
--- a/clang/lib/AST/Interp/InterpFrame.cpp
+++ b/clang/lib/AST/Interp/InterpFrame.cpp
@@ -228,7 +228,7 @@ Pointer InterpFrame::getParamPointer(unsigned Off) {
SourceInfo InterpFrame::getSource(CodePtr PC) const {
// Implicitly created functions don't have any code we could point at,
// so return the call site.
- if (Func && Func->getDecl()->isImplicit() && Caller)
+ if (Func && (!Func->hasBody() || Func->getDecl()->isImplicit()) && Caller)
return Caller->getSource(RetPC);
return S.getSource(Func, PC);
@@ -243,7 +243,7 @@ SourceLocation InterpFrame::getLocation(CodePtr PC) const {
}
SourceRange InterpFrame::getRange(CodePtr PC) const {
- if (Func && Func->getDecl()->isImplicit() && Caller)
+ if (Func && (!Func->hasBody() || Func->getDecl()->isImplicit()) && Caller)
return Caller->getRange(RetPC);
return S.getRange(Func, PC);
More information about the cfe-commits
mailing list