Skip to content

Commit 8f15c4c

Browse files
committed
[clang][Interp][NFC] Add Record::getDestructor()
Unused for now but will be used in later commits.
1 parent 284bd95 commit 8f15c4c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

clang/lib/AST/Interp/Record.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
#ifndef LLVM_CLANG_AST_INTERP_RECORD_H
1414
#define LLVM_CLANG_AST_INTERP_RECORD_H
1515

16-
#include "clang/AST/Decl.h"
1716
#include "Descriptor.h"
17+
#include "clang/AST/Decl.h"
18+
#include "clang/AST/DeclCXX.h"
1819

1920
namespace clang {
2021
namespace interp {
@@ -62,6 +63,12 @@ class Record final {
6263
const Base *getBase(const RecordDecl *FD) const;
6364
/// Returns a virtual base descriptor.
6465
const Base *getVirtualBase(const RecordDecl *RD) const;
66+
// Returns the destructor of the record, if any.
67+
const CXXDestructorDecl *getDestructor() const {
68+
if (const auto *CXXDecl = dyn_cast<CXXRecordDecl>(Decl))
69+
return CXXDecl->getDestructor();
70+
return nullptr;
71+
}
6572

6673
using const_field_iter = FieldList::const_iterator;
6774
llvm::iterator_range<const_field_iter> fields() const {

0 commit comments

Comments
 (0)