mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
cb58b8a526
`ExprNode` and its child classes use LLVM-style RTTI. Until now their destruction was not handled properly, causing the constructor-destructor type mismatch warnings on ASAN. Despite this all the code was working properly, but just for luck, because of the fact that these classes are very shallow. This commit fixes the issue, and allow `ExprNode` and its child classes to be extended without worrying about wrong destructors being invoked.
29 lines
659 B
C++
29 lines
659 B
C++
//
|
|
// This file is distributed under the MIT License. See LICENSE.md for details.
|
|
//
|
|
|
|
// revng includes
|
|
#include <revng/Support/Debug.h>
|
|
|
|
// Local libraries includes
|
|
#include "revng-c/RestructureCFGPass/ExprNode.h"
|
|
|
|
void ExprNode::deleteExprNode(ExprNode *E) {
|
|
switch (E->getKind()) {
|
|
case NodeKind::NK_Atomic:
|
|
delete static_cast<AtomicNode *>(E);
|
|
break;
|
|
case NodeKind::NK_Not:
|
|
delete static_cast<NotNode *>(E);
|
|
break;
|
|
case NodeKind::NK_And:
|
|
delete static_cast<AndNode *>(E);
|
|
break;
|
|
case NodeKind::NK_Or:
|
|
delete static_cast<OrNode *>(E);
|
|
break;
|
|
default:
|
|
revng_unreachable("Deleting unexpected ExprNode");
|
|
}
|
|
}
|