mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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:
@@ -726,7 +726,7 @@ protected:
|
||||
HasAnyUnavailableDuringLoweringValues : 1
|
||||
);
|
||||
|
||||
SWIFT_INLINE_BITFIELD(ModuleDecl, TypeDecl, 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+8,
|
||||
SWIFT_INLINE_BITFIELD(ModuleDecl, TypeDecl, 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+8,
|
||||
/// If the module is compiled as static library.
|
||||
StaticLibrary : 1,
|
||||
|
||||
@@ -792,7 +792,10 @@ protected:
|
||||
AllowNonResilientAccess : 1,
|
||||
|
||||
/// Whether this module has been built with -package-cmo.
|
||||
SerializePackageEnabled : 1
|
||||
SerializePackageEnabled : 1,
|
||||
|
||||
/// Whether this module has enabled strict memory safety checking.
|
||||
StrictMemorySafety : 1
|
||||
);
|
||||
|
||||
SWIFT_INLINE_BITFIELD(PrecedenceGroupDecl, Decl, 1+2,
|
||||
|
||||
@@ -830,6 +830,15 @@ public:
|
||||
Bits.ModuleDecl.IsConcurrencyChecked = value;
|
||||
}
|
||||
|
||||
/// Whether this module has enable strict memory safety checking.
|
||||
bool strictMemorySafety() const {
|
||||
return Bits.ModuleDecl.StrictMemorySafety;
|
||||
}
|
||||
|
||||
void setStrictMemorySafety(bool value = true) {
|
||||
Bits.ModuleDecl.StrictMemorySafety = value;
|
||||
}
|
||||
|
||||
bool isObjCNameLookupCachePopulated() const {
|
||||
return Bits.ModuleDecl.ObjCNameLookupCachePopulated;
|
||||
}
|
||||
|
||||
@@ -149,6 +149,7 @@ class ExtendedValidationInfo {
|
||||
unsigned HasCxxInteroperability : 1;
|
||||
unsigned AllowNonResilientAccess: 1;
|
||||
unsigned SerializePackageEnabled: 1;
|
||||
unsigned StrictMemorySafety: 1;
|
||||
} Bits;
|
||||
public:
|
||||
ExtendedValidationInfo() : Bits() {}
|
||||
@@ -246,6 +247,13 @@ public:
|
||||
void setIsConcurrencyChecked(bool val = true) {
|
||||
Bits.IsConcurrencyChecked = val;
|
||||
}
|
||||
bool strictMemorySafety() const {
|
||||
return Bits.StrictMemorySafety;
|
||||
}
|
||||
void setStrictMemorySafety(bool val = true) {
|
||||
Bits.StrictMemorySafety = val;
|
||||
}
|
||||
|
||||
bool hasCxxInteroperability() const { return Bits.HasCxxInteroperability; }
|
||||
void setHasCxxInteroperability(bool val) {
|
||||
Bits.HasCxxInteroperability = val;
|
||||
|
||||
Reference in New Issue
Block a user