Expand description
Inheritance Safety Analysis
This module implements Rust-inspired safety checks for C++ inheritance.
Core principle: Inheritance is @unsafe by default, except when inheriting from @interface.
An @interface is a pure virtual class (like a Rust trait):
- All methods are pure virtual (= 0)
- No non-static data members
- Virtual destructor required
- Can only inherit from other @interfaces
Interface methods can be marked @safe or @unsafe. Implementations must:
- Match the safety annotation (if explicitly annotated)
- Inherit the safety annotation (if not explicitly annotated)
- Be validated for safety if marked @safe
Functions§
- check_
inheritance_ safety - Run all inheritance safety checks
- check_
method_ safety_ contracts - Check that method implementations honor interface method safety contracts
- check_
safe_ class_ copy_ semantics - Check that @safe classes don’t have non-deleted copy operations
- check_
safe_ inheritance - Check that classes in @safe context only inherit from @interface classes
- collect_
interface_ map - Build a map of interface classes for method safety checking
- collect_
interfaces - Build a set of interface class names from the parsed classes
- validate_
interface - Validate that a class marked as @interface is truly a pure interface
- validate_
interface_ inheritance - Check that @interface classes only inherit from other @interfaces