mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Enforce that FileUnit + LoadedFile have trivial destructors
We already do this for other ASTContext-allocated types (see Decl.cpp). This will prevent the sort of mistakes in the previous two commits. Note that if any particular subclass of FileUnit wants to have its destructor run, it can opt into that manually using ASTContext::addDestructorCleanup. SourceFile and BuiltinUnit both do this. But we generally don't /want/ to do this if we can avoid it because it adds to compiler teardown time.
This commit is contained in:
@@ -38,6 +38,9 @@ using namespace swift::serialization;
|
||||
using namespace llvm::support;
|
||||
using llvm::Expected;
|
||||
|
||||
static_assert(IsTriviallyDestructible<SerializedASTFile>::value,
|
||||
"SerializedASTFiles are BumpPtrAllocated; d'tors are not called");
|
||||
|
||||
static bool checkModuleSignature(llvm::BitstreamCursor &cursor,
|
||||
ArrayRef<unsigned char> signature) {
|
||||
for (unsigned char byte : signature)
|
||||
|
||||
Reference in New Issue
Block a user