Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions clang/lib/AST/ByteCode/Interp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1207,17 +1207,15 @@ static bool runRecordDestructor(InterpState &S, CodePtr OpPC,
}

// Destructor of this record.
if (const CXXDestructorDecl *Dtor = R->getDestructor();
Dtor && !Dtor->isTrivial()) {
const Function *DtorFunc = S.getContext().getOrCreateFunction(Dtor);
if (!DtorFunc)
return false;
const CXXDestructorDecl *Dtor = R->getDestructor();
assert(Dtor);
assert(!Dtor->isTrivial());
const Function *DtorFunc = S.getContext().getOrCreateFunction(Dtor);
if (!DtorFunc)
return false;

S.Stk.push<Pointer>(BasePtr);
if (!Call(S, OpPC, DtorFunc, 0))
return false;
}
return true;
S.Stk.push<Pointer>(BasePtr);
return Call(S, OpPC, DtorFunc, 0);
}

static bool RunDestructors(InterpState &S, CodePtr OpPC, const Block *B) {
Expand All @@ -1229,6 +1227,9 @@ static bool RunDestructors(InterpState &S, CodePtr OpPC, const Block *B) {

assert(Desc->isRecord() || Desc->isCompositeArray());

if (Desc->hasTrivialDtor())
return true;

if (Desc->isCompositeArray()) {
unsigned N = Desc->getNumElems();
if (N == 0)
Expand Down