This is an archive of the discontinued LLVM Phabricator instance.

[Clang] Add helper method to determine if a nonvirtual base has an entry in the LLVM struct
ClosedPublic

Authored by wsmoses on Mar 25 2022, 12:42 PM.

Details

Summary

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.

Diff Detail

Event Timeline

wsmoses created this revision.Mar 25 2022, 12:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 25 2022, 12:42 PM
wsmoses requested review of this revision.Mar 25 2022, 12:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 25 2022, 12:42 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript

I'm not against this, I guess... but clang/lib/CodeGen/CGRecordLayout.h isn't an installed header; it's not clear to me how you're using this.

Polygeist is a (hopefully soon to be LLVM incubator project: https://discourse.llvm.org/t/rfc-polygeist-llvm-incubator-proposal/60890), that, among other things, is a Clang-based C/C++ frontend for MLIR. As such, we kind of expect to be built alongside clang and borrow the header. As the project gets closer to upstream, hopefully the include sharing will actually be more explicit (and will be made an upstream PR regardless after some other technical debt and paper deadlines).

The relevant code that needs this from our side is here, if curious: https://github.com/wsmoses/Polygeist/pull/198/files

This revision is now accepted and ready to land.Mar 25 2022, 1:24 PM