forked from OSchip/llvm-project
[Clang] Add helper method to determine if a nonvirtual base has an entry in the LLVM struct
This patch adds a helper method to determine if a nonvirtual base has an entry in the LLVM struct. Such a base may not have an entry if the base does not have any fields/bases itself that would change the size of the struct. This utility method is useful for other frontends (Polygeist) that use Clang as an API to generate code. Reviewed By: efriedma Differential Revision: https://reviews.llvm.org/D122502
This commit is contained in:
parent
6aa0397758
commit
89525cbf28
|
@ -200,6 +200,12 @@ public:
|
|||
return FieldInfo.lookup(FD);
|
||||
}
|
||||
|
||||
// Return whether the following non virtual base has a corresponding
|
||||
// entry in the LLVM struct.
|
||||
bool hasNonVirtualBaseLLVMField(const CXXRecordDecl *RD) const {
|
||||
return NonVirtualBases.count(RD);
|
||||
}
|
||||
|
||||
unsigned getNonVirtualBaseLLVMFieldNo(const CXXRecordDecl *RD) const {
|
||||
assert(NonVirtualBases.count(RD) && "Invalid non-virtual base!");
|
||||
return NonVirtualBases.lookup(RD);
|
||||
|
|
Loading…
Reference in New Issue