[clang] 2f808dd - [clang][bytecode] Compile most recent function decl (#131730)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 17 23:29:41 PDT 2025
Author: Timm Baeder
Date: 2025-03-18T07:29:38+01:00
New Revision: 2f808dd0702ba3c364eb4373714a1fb09078909d
URL: https://github.com/llvm/llvm-project/commit/2f808dd0702ba3c364eb4373714a1fb09078909d
DIFF: https://github.com/llvm/llvm-project/commit/2f808dd0702ba3c364eb4373714a1fb09078909d.diff
LOG: [clang][bytecode] Compile most recent function decl (#131730)
We used to always do this because all calls went through the code path
that calls getMostRecentDecl(). Do it now, too.
Added:
Modified:
clang/lib/AST/ByteCode/Interp.cpp
clang/test/AST/ByteCode/records.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/ByteCode/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp
index 9b30a3d418ee3..b4ea825ce472c 100644
--- a/clang/lib/AST/ByteCode/Interp.cpp
+++ b/clang/lib/AST/ByteCode/Interp.cpp
@@ -1364,7 +1364,8 @@ static bool checkDestructor(InterpState &S, CodePtr OpPC, const Function *Func,
static void compileFunction(InterpState &S, const Function *Func) {
Compiler<ByteCodeEmitter>(S.getContext(), S.P)
- .compileFunc(Func->getDecl(), const_cast<Function *>(Func));
+ .compileFunc(Func->getDecl()->getMostRecentDecl(),
+ const_cast<Function *>(Func));
}
bool CallVar(InterpState &S, CodePtr OpPC, const Function *Func,
diff --git a/clang/test/AST/ByteCode/records.cpp b/clang/test/AST/ByteCode/records.cpp
index 42b6d82d7190b..5d9f1044f206b 100644
--- a/clang/test/AST/ByteCode/records.cpp
+++ b/clang/test/AST/ByteCode/records.cpp
@@ -1759,3 +1759,15 @@ namespace IncompleteTypes {
}
static_assert(foo(), "");
}
+
+namespace RedeclaredCtor {
+
+ struct __sp_mut {
+ void *__lx_;
+ constexpr __sp_mut(void *) noexcept;
+ };
+ int mut_back[1];
+
+ constexpr __sp_mut::__sp_mut(void *p) noexcept : __lx_(p) {}
+ constexpr __sp_mut muts = &mut_back[0];
+}
More information about the cfe-commits
mailing list