Open Bug 1778339 Opened 3 years ago Updated 3 years ago

Consider a clang-plugin check to verify struct and vtable layouts for XPIDL interfaces

Categories

(Core :: XPCOM, enhancement)

enhancement

Tracking

()

People

(Reporter: nika, Unassigned)

References

Details

In bug 1778211, I introduced a basic check to the XPIDL compiler to attempt to prevent folks adding virtual methods to XPIDL interfaces, as it can cause issues with XPConnect and the Rust bindings. This follow-up is to look into adding a more complex clang-plugin check by annotating the interface with details about what methods we expect to be declared, and having clang double-check that the struct layout and virtual method order is what we expect.

If we decide to also validate struct layout we may need to introduce a stronger version of [builtinclass] which also prevents the class from being implemented in Rust, as there are some interfaces with extra data fields declared in C++ (such as nsIEventTarget) which can therefore only be implemented by C++ code. This is unfortunately currently not checked by the Rust bindings.

You need to log in before you can comment on or make changes to this bug.