[clang] 2308d46 - [clang][Interp][NFC] Rename locals and add assertions to virtual casts
Timm Bäder via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 26 00:22:07 PDT 2024
Author: Timm Bäder
Date: 2024-04-26T09:21:52+02:00
New Revision: 2308d4697e0b3b0cfd905e2b025ea905ee763fbe
URL: https://github.com/llvm/llvm-project/commit/2308d4697e0b3b0cfd905e2b025ea905ee763fbe
DIFF: https://github.com/llvm/llvm-project/commit/2308d4697e0b3b0cfd905e2b025ea905ee763fbe.diff
LOG: [clang][Interp][NFC] Rename locals and add assertions to virtual casts
Added:
Modified:
clang/lib/AST/Interp/Interp.h
clang/lib/AST/Interp/Opcodes.td
Removed:
################################################################################
diff --git a/clang/lib/AST/Interp/Interp.h b/clang/lib/AST/Interp/Interp.h
index 9283f697c00709..0e9f287cd2218f 100644
--- a/clang/lib/AST/Interp/Interp.h
+++ b/clang/lib/AST/Interp/Interp.h
@@ -1355,12 +1355,14 @@ inline bool VirtBaseHelper(InterpState &S, CodePtr OpPC, const RecordDecl *Decl,
while (Base.isBaseClass())
Base = Base.getBase();
- auto *Field = Base.getRecord()->getVirtualBase(Decl);
- S.Stk.push<Pointer>(Base.atField(Field->Offset));
+ const Record::Base *VirtBase = Base.getRecord()->getVirtualBase(Decl);
+ S.Stk.push<Pointer>(Base.atField(VirtBase->Offset));
return true;
}
-inline bool GetPtrVirtBase(InterpState &S, CodePtr OpPC, const RecordDecl *D) {
+inline bool GetPtrVirtBasePop(InterpState &S, CodePtr OpPC,
+ const RecordDecl *D) {
+ assert(D);
const Pointer &Ptr = S.Stk.pop<Pointer>();
if (!CheckNull(S, OpPC, Ptr, CSK_Base))
return false;
@@ -1369,6 +1371,7 @@ inline bool GetPtrVirtBase(InterpState &S, CodePtr OpPC, const RecordDecl *D) {
inline bool GetPtrThisVirtBase(InterpState &S, CodePtr OpPC,
const RecordDecl *D) {
+ assert(D);
if (S.checkingPotentialConstantExpression())
return false;
const Pointer &This = S.Current->getThis();
diff --git a/clang/lib/AST/Interp/Opcodes.td b/clang/lib/AST/Interp/Opcodes.td
index 742785b28eb4d7..2a97b978b52325 100644
--- a/clang/lib/AST/Interp/Opcodes.td
+++ b/clang/lib/AST/Interp/Opcodes.td
@@ -336,7 +336,7 @@ def GetPtrDerivedPop : Opcode {
}
// [Pointer] -> [Pointer]
-def GetPtrVirtBase : Opcode {
+def GetPtrVirtBasePop : Opcode {
// RecordDecl of base class.
let Args = [ArgRecordDecl];
}
More information about the cfe-commits
mailing list