Skip to content

Commit 2308d46

Browse files
committed
[clang][Interp][NFC] Rename locals and add assertions to virtual casts
1 parent 0d56d88 commit 2308d46

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

clang/lib/AST/Interp/Interp.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,12 +1355,14 @@ inline bool VirtBaseHelper(InterpState &S, CodePtr OpPC, const RecordDecl *Decl,
13551355
while (Base.isBaseClass())
13561356
Base = Base.getBase();
13571357

1358-
auto *Field = Base.getRecord()->getVirtualBase(Decl);
1359-
S.Stk.push<Pointer>(Base.atField(Field->Offset));
1358+
const Record::Base *VirtBase = Base.getRecord()->getVirtualBase(Decl);
1359+
S.Stk.push<Pointer>(Base.atField(VirtBase->Offset));
13601360
return true;
13611361
}
13621362

1363-
inline bool GetPtrVirtBase(InterpState &S, CodePtr OpPC, const RecordDecl *D) {
1363+
inline bool GetPtrVirtBasePop(InterpState &S, CodePtr OpPC,
1364+
const RecordDecl *D) {
1365+
assert(D);
13641366
const Pointer &Ptr = S.Stk.pop<Pointer>();
13651367
if (!CheckNull(S, OpPC, Ptr, CSK_Base))
13661368
return false;
@@ -1369,6 +1371,7 @@ inline bool GetPtrVirtBase(InterpState &S, CodePtr OpPC, const RecordDecl *D) {
13691371

13701372
inline bool GetPtrThisVirtBase(InterpState &S, CodePtr OpPC,
13711373
const RecordDecl *D) {
1374+
assert(D);
13721375
if (S.checkingPotentialConstantExpression())
13731376
return false;
13741377
const Pointer &This = S.Current->getThis();

clang/lib/AST/Interp/Opcodes.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ def GetPtrDerivedPop : Opcode {
336336
}
337337

338338
// [Pointer] -> [Pointer]
339-
def GetPtrVirtBase : Opcode {
339+
def GetPtrVirtBasePop : Opcode {
340340
// RecordDecl of base class.
341341
let Args = [ArgRecordDecl];
342342
}

0 commit comments

Comments
 (0)