Add module trace information for strict memory safety

Extend the module trace format with a field indicating whether a given
module, or any module it depends on, was compiled with strict memory
safety enabled. This separate output from the compiler can be used as
part of an audit to determine what parts of Swift programs are built
with strict memory safety checking enabled.
This commit is contained in:
Doug Gregor
2024-12-24 12:27:35 -08:00
parent 92fbedcbc0
commit d593442cc4
15 changed files with 85 additions and 8 deletions

View File

@@ -415,8 +415,11 @@ private:
/// Whether this module is built with -package-cmo.
unsigned SerializePackageEnabled : 1;
/// Whether this module enabled strict memory safety.
unsigned StrictMemorySafety : 1;
// Explicitly pad out to the next word boundary.
unsigned : 3;
unsigned : 2;
} Bits = {};
static_assert(sizeof(ModuleBits) <= 8, "The bit set should be small");
@@ -667,6 +670,8 @@ public:
bool isConcurrencyChecked() const { return Bits.IsConcurrencyChecked; }
bool strictMemorySafety() const { return Bits.StrictMemorySafety; }
/// How should \p dependency be loaded for a transitive import via \c this?
///
/// If \p importNonPublicDependencies, more transitive dependencies